Page 1 of 1

PB5.42LTS; ComboboxGadget; set selection cursor;

Posted: Tue Feb 16, 2016 4:07 pm
by HanPBF
Hello!

How can I set the selection cursor in a combobox.

I found that link in PB, but it does not work: http://www.purebasic.fr/english/viewtop ... w=previous

Problem is, that I want to filter the list; after resetting the comboboxgadget items, the selection cursor in the textpart of the box jumps at the beginning.

Any ideas?

Thanks a lot!

__________________________________________________
Link repaired
16.02.2016
RSBasic

[SOLVED]; PB5.42LTS; ComboboxGadget; set selection cursor;

Posted: Tue Feb 16, 2016 4:28 pm
by HanPBF
O.k.
found that solution:

Code: Select all

 keybd_event_(#VK_END, 0, 0, 0)
With GetGadgetText and GetGadgetState should be possible to later add autocomplete to combobox.

Re: PB5.42LTS; ComboboxGadget; set selection cursor;

Posted: Tue Feb 16, 2016 5:23 pm
by RSBasic
HanPBF wrote:found that solution:

Code: Select all

keybd_event_(#VK_END, 0, 0, 0)
Do you want to set the cursor to the end?

Code: Select all

EnableExplicit

Define EventID

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ComboBoxGadget(1, 10, 10, 200, 20, #PB_ComboBox_Editable)
  AddGadgetItem(1, -1, "Item 1")
  AddGadgetItem(1, -1, "Item 2")
  AddGadgetItem(1, -1, "Item 3")
  
  SetGadgetState(1, 1)
  SetActiveGadget(1)
  SendMessage_(GetWindow_(GadgetID(1), #GW_CHILD), #EM_SETSEL, $fffffff, $fffffff)
 
  Repeat
    EventID = WaitWindowEvent()
    If EventID = #PB_Event_CloseWindow
      End
    EndIf
  ForEver
EndIf