Squall_FF8 0 Posted 4 hours ago Hey guys, I'm trying to implement: when the user presses ArrowDown key on tComboEdit, to open the ListBox and focus it (maybe even to select the first item). However unlike tComboBox, the LstBox is not exposed. How I can get a pointer to it? Share this post Link to post
Lajos Juhász 311 Posted 4 hours ago (edited) To achieve that you can call the DropDown method of the comboedit. procedure TForm4.ComboEdit1KeyUp(Sender: TObject; var Key: Word; var KeyChar: WideChar; Shift: TShiftState); begin if key=vkDown then ComboEdit1.DropDown; end; Edited 4 hours ago by Lajos Juhász example Share this post Link to post
Squall_FF8 0 Posted 4 hours ago Just now, Lajos Juhász said: To achieve that you can call the DropDown method of the comboedit. That will do only the halve of the job - to show the ListBox,, but it will not focus it (also some other operations if I have a pointer) Share this post Link to post
Lajos Juhász 311 Posted 4 hours ago In my case the itemindex was already 0 that made the selection. You can do it: if key=vkDown then begin ComboEdit1.ItemIndex:=0; ComboEdit1.DropDown; end; Share this post Link to post
Squall_FF8 0 Posted 3 hours ago 8 minutes ago, Lajos Juhász said: In my case the itemindex was already 0 that made the selection. You can do it: if key=vkDown then begin ComboEdit1.ItemIndex:=0; ComboEdit1.DropDown; end; Thank you for taking time to help me. I tried the code from your snippet. It works ... but not how I would like: - the listBox is not focused - you can't browse the list with the keyboard - by setting ItemIndex, you change the text (in the Edit part) Share this post Link to post