Comboboxgadget() open and display

Windows specific forum
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

Comboboxgadget() open and display

Post 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.
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

Post by localmotion34 »

sendmessage_(combohwnd,#CB_SHOWDROPDOWN,0,0)

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

Post by localmotion34 »

sendmessage_(combohwnd,#CB_SHOWDROPDOWN,0,0)

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

Post by PB&J Lover »

localmotion34 wrote:sendmessage_(combohwnd,#CB_SHOWDROPDOWN,0,0)
So would combohwnd be my comboboxgadget handle/constant?


Thanks. :)
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

Post by PB&J Lover »

Thanks. I thought that was the case.
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
Post Reply