Squall_FF8 0 Posted Wednesday at 02:12 PM 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 Wednesday at 02:17 PM (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 Wednesday at 02:20 PM by Lajos Juhász example Share this post Link to post
Squall_FF8 0 Posted Wednesday at 02:22 PM 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 Wednesday at 02:32 PM 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 Wednesday at 03:03 PM 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
Squall_FF8 0 Posted Thursday at 09:11 AM Any idea how to obtain a pointer to the dropped down LiestBox? Share this post Link to post
Squall_FF8 0 Posted Friday at 02:48 PM I found the answer: ListBox := TStyledComboEdit(ComboBox.Presentation).ListBox Share this post Link to post