Is there a way to drop down a TJvComboEdit's AutoComplete list when the button is pressed?

605 views Asked by At

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)?

1

There are 1 answers

0
TLama On BEST ANSWER

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;