Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

TElTreeInplaceComboBox: Accepting an item not in the list.

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

  • 3 Comments sorted by Votes Date Added
  • 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.