1

I have got a form with a TJvComboEdit control (from Jedi Visual Components library, jvcl) on it. This control has got an AutoCompleteList and if I set AutoCompleteOptions to acoUpDownKeyDropsList I can at runtime show this list by pressing the up or down key.

So far, that's fine, but in addition to that I want the control's button to also show that list (like a TComboBox button does) but I can not find any way to do that. The showing of the list seems to be done by some internal IAutoComplete Windows interface which does not expose an api for showing the list.

Am I missing something? Or is there any other control I could use instead? (apart from the obvious TComboBox)?

TLama
  • 75,147
  • 17
  • 214
  • 392
dummzeuch
  • 10,975
  • 4
  • 51
  • 158
  • Wouldn't that be a bit weird. Auto complete lists depend on the context of what has already been typed and change when you type new keys. Combo drop down buttons are meant to show all possible options rather than just those that match the partially typed edit text. – David Heffernan Jan 31 '12 at 09:58
  • 3
    No, it would be fine, since you can also invoke this (full) list with the up/down key. – dummzeuch Jan 31 '12 at 12:31
  • I've been looking for some time for a clean way to invoke the `IAutoComplete2` interface to drop the list down but unfortunately it seems there's no (at least documented) way to do it (except simulating key press). – TLama Feb 20 '12 at 20:20

1 Answers1

2

The TJvComboEdit uses the IAutoComplete and IAutoComplete2 interfaces for autocomplete features and there is no way to invoke the drop down list for them manually.

You can use the following hack which sets the focus to the TJvComboEdit and simulate the key.

procedure TForm1.Button1Click(Sender: TObject);
begin
  if JvComboEdit1.CanFocus then
  begin
    JvComboEdit1.SetFocus;
    keybd_event(VK_DOWN, 0, 0, 0);
    keybd_event(VK_DOWN, 0, KEYEVENTF_KEYUP, 0);
  end;
end;
TLama
  • 75,147
  • 17
  • 214
  • 392