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