Page 1 of 1

ComboBoxGadget() DropDown height

Posted: Tue Sep 16, 2008 6:00 pm
by nco2k
since 4.30 the behavior of the ComboBoxGadget() height param has changed. with this trick you can set the height of the dropdown:

Code: Select all

If OpenWindow(0, 0, 0, 200, 110, "ComboBox Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ComboBoxGadget(0, 5, 5, 190, #PB_Ignore, #CBS_NOINTEGRALHEIGHT)
  For i = 1 To 10
    AddGadgetItem(0, -1, "ComboBox item " + Str(i))
  Next
  SetGadgetState(0, 0)
  MoveWindow_(GadgetID(0), GadgetX(0), GadgetY(0), GadgetWidth(0), 100, #True)
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf : End
if you know a better solution, feel free to share it.

c ya,
nco2k

Re: ComboBoxGadget() DropDown height

Posted: Mon Sep 29, 2008 7:12 am
by PB
Thanks for that. Don't know why it was changed anyway. The old way was far
better and more useful. Who wants to change the height when the text won't
fill to that height anyway? (See image). I'd prefer it to go back to the old way.

Image

Posted: Mon Sep 29, 2008 11:14 am
by Fred
It wasn't the only one gadget where the heieght wasn't the height. When you don't know it, the droplix just doesn't show, it wasn't acceptable. About the stringbox, it's like the StringGadget..

Posted: Tue Sep 30, 2008 12:30 am
by Rescator
A larger font will fill that extra height :)

I like the new behavior, it seems "correct" and I can finaly make the combo box match the height of my string gadgets and buttons and not the other way around :)

Posted: Tue Sep 30, 2008 9:11 am
by PB
> I can finaly make the combo box match the height of my string gadgets

True, I forgot about that. I suppose it's a good change then. :)

Re: ComboBoxGadget() DropDown height

Posted: Fri Apr 02, 2010 10:49 am
by nco2k
it doesnt work with 4.50 anymore.. fred any chance, to restore this? :/

c ya,
nco2k

Re: ComboBoxGadget() DropDown height

Posted: Fri Apr 02, 2010 2:34 pm
by breeze4me
Try this one. It seems to work. (x86 XP SP3)

Code: Select all

If OpenWindow(0, 0, 0, 200, 110, "ComboBox Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ComboBoxGadget(0, 5, 5, 190, 20)
  
  For i = 1 To 10
    AddGadgetItem(0, -1, "ComboBox item " + Str(i))
  Next
  SetGadgetState(0, 0)
  ;MoveWindow_(FindWindowEx_(GadgetID(0), 0, 0, 0), 0, 0, GadgetWidth(0), 100, #True)
  ;or
  MoveWindow_(GetWindow_(GadgetID(0), #GW_CHILD), 0, 0, GadgetWidth(0), 100, #True)
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf : End

Re: ComboBoxGadget() DropDown height

Posted: Fri Apr 02, 2010 5:27 pm
by nco2k
very nice, thx. :)

c ya,
nco2k

Re: ComboBoxGadget() DropDown height

Posted: Wed May 08, 2024 4:33 pm
by Michael Vogel
Does anyone know a solution for comboboxes with images?

The top two gadgets do work (enlarged dropdown box height, the two gadgets at the bottom stay with their default height)

Code: Select all

Global Dim flag(3)

flag(1)=#PB_ComboBox_Editable
flag(2)=#PB_ComboBox_Image

OpenWindow(0,10,10,200,170,"ComboBox Example",#PB_Window_SystemMenu)

For g=0 To 3
	flag=flag(g&1)|flag(g&2)|flag(g&4)
	ComboBoxGadget(g,10,10+g*40,180,30,flag|#CBS_NOINTEGRALHEIGHT)
	MoveWindow_(GadgetID(g),GadgetX(g),GadgetY(g),GadgetWidth(g),1000,#True)

	For i = 1 To 40
		AddGadgetItem(g, -1, "ComboBox item"+Str(i))
	Next
	SetGadgetText(g,"$"+Hex(flag))
Next g

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: ComboBoxGadget() DropDown height

Posted: Wed May 08, 2024 5:08 pm
by breeze4me
Michael Vogel wrote: Wed May 08, 2024 4:33 pm Does anyone know a solution for comboboxes with images?

Code: Select all

Global Dim flag(3)

flag(1)=#PB_ComboBox_Editable
flag(2)=#PB_ComboBox_Image

OpenWindow(0,10,10,200,170,"ComboBox Example",#PB_Window_SystemMenu)

Define sBuffer.s{32}

For g=0 To 3
  flag=flag(g&1)|flag(g&2)|flag(g&4)
  ComboBoxGadget(g,10,10+g*40,180,30,flag | #CBS_NOINTEGRALHEIGHT)
  
  GetClassName_(GadgetID(g), @sBuffer, 30)
  
  If sBuffer = "ComboBox"
    MoveWindow_(GadgetID(g),GadgetX(g),GadgetY(g),GadgetWidth(g),1000,#True)
    
    ; The height of the gadget will change to the default value, so it should be adjusted.
    ResizeGadget(g, #PB_Ignore, #PB_Ignore, #PB_Ignore, 30)
    
  ElseIf sBuffer = "ComboBoxEx32"
    MoveWindow_(GetWindow_(GadgetID(g), #GW_CHILD), 0, 0, GadgetWidth(g), 1000, #True)
  EndIf
  
  For i = 1 To 40
    AddGadgetItem(g, -1, "ComboBox item"+Str(i))
  Next
  SetGadgetText(g,"$"+Hex(flag))
Next g

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: ComboBoxGadget() DropDown height

Posted: Wed May 08, 2024 9:26 pm
by Michael Vogel
Works fine, thanks.

Just an observation - which has nothing to do with resizing the gadget but with the combobox itself: the dialog needs quite a while here until the initialization is done (tested with PB5.73 and PB6.04).

When replacing the ComboBoxGadget by any other gadget type, e.g. with ListViewGadget(g,10,10+g*40,180,30), the dialog is ready with no delay.

So, is the ComboBoxGadget a lame duck?