Page 1 of 1

Comboboxgadget() open and display

Posted: Wed Jun 08, 2005 2:42 pm
by PB&J Lover
Hello PB users,

How do I get a comboboxgadget to open up and display a particular item? I know I can set the item by index and that item will display, but the comboboxgadget does not open up.

I've done it in another BASIC with a dll call:

Code: Select all

Calldll #user32, "SendMessageA", hWnd as long, __CB_SHOWDROPDOWN as long, 1 as long, 0 as long, r as void.
Is there a native PB solution?

Thanks.

Posted: Wed Jun 08, 2005 4:05 pm
by localmotion34
sendmessage_(combohwnd,#CB_SHOWDROPDOWN,0,0)

Posted: Wed Jun 08, 2005 4:05 pm
by localmotion34
sendmessage_(combohwnd,#CB_SHOWDROPDOWN,0,0)

Posted: Wed Jun 08, 2005 4:12 pm
by PB&J Lover
localmotion34 wrote:sendmessage_(combohwnd,#CB_SHOWDROPDOWN,0,0)
So would combohwnd be my comboboxgadget handle/constant?


Thanks. :)

Posted: Wed Jun 08, 2005 9:54 pm
by Sparkie

Code: Select all

If OpenWindow(0, 0, 0, 270, 140, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "ComboBoxGadget") And CreateGadgetList(WindowID(0))
  ButtonGadget(0, 10, 10, 250, 20, "Show List")
  ComboBoxGadget(1, 10, 40, 250, 80)
  For i = 1 To 5
    AddGadgetItem(1, -1, "ComboBox item " + Str(i))
  Next i
  Repeat
    event = WaitWindowEvent()
    If event = #PB_EventGadget And EventGadgetID() = 0
      SendMessage_(GadgetID(1), #CB_SHOWDROPDOWN, 1, 0)
      SetGadgetState(1, 2)
    EndIf
  Until event = #PB_Event_CloseWindow
EndIf
End

Posted: Thu Jun 09, 2005 3:54 am
by PB&J Lover
Thanks. I thought that was the case.