This forum is temporaily read-only. All existing discussions remain available for reference. For new questions, bug reports or support requests, please contact us at mail@lmdsupport.com.

TElTreeInplaceComboBox: Accepting an item not in the list.

edited October 2013 in LMD ElPack
InplaceCB : TElTreeInplaceComboBox

I have the following events:

procedure TMainForm.InplaceCBValidateResult(Sender: TObject;
  var InputValid: Boolean);
begin
  if InplaceCB.Items.IndexOf(InplaceCB.Editor.Text) = -1 then // not in the list
  begin
    InplaceCB.Items.Append(InplaceCB.Editor.Text);
  end;

  EditedText := InplaceCB.Editor.Text; // Unnecessary, but used because the value became ''

  InputValid := True;
end;

procedure TMainForm.InplaceCBAfterOperation(Sender: TObject; var Accepted,
  DefaultConversion: Boolean);
begin
  if InplaceCB.Items.IndexOf(EditedText) = -1 then // not in the list
  begin
    InplaceCB.Items.Append(EditedText);
  end;

  ItemTree.ItemFocused.Cells[INDEX_Group].Text := EditedText; // Shouldn't have had to write this code!

  Accepted := True;
end;

If the ComboBox is closed when a new value is entered (i.e. not in the list), then the above code works to accept the value and the ElXTree places the new value in the cell.

If the ComboBox is Dropped Down then InplaceCB.Editor.Text = '', which is incorrect.

What needs to be done to be able to accept a new value when the list is dropped down?
Thanks.Raymond

Comments

  • I am sorry, but I can not reproduce ths issue. When I add dynamically add items to the list, they are correctly selected in combo.
    Please send example project to our mail account.

  • Example project sent to your mail account on 30 October 2013.

    Do you need more information from me?

    As I cannot find a work-around or alternative for this, I am keen for you to either let me know what to do (using my demo as a basis) or fix the issue (if it is one).

    Thanks.

    Raymond.
Sign In or Register to comment.