Combobox dropdown height

BlitzMax Forums/BlitzMax GUI Programming/Combobox dropdown height

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I've attempted the following to allow you to set combo box height in OS X. It seems to work, but testing is appreciated as this is my first real foray under the bonnet.

in cocoa.macos.m insert towards the end (I placed it after int NSClientWidth(nsgadget *gadget){..})
void NSSetComboBoxDropDownHeight(nsgadget *gadget, int num_rows){
	if(gadget && num_rows > 0){
		NSComboBox		*combo;
		combo=(NSComboBox*)gadget->handle;
		if(combo) [combo setNumberOfVisibleItems:num_rows];
	}
}

In cocoagui.bmx Insert at the end of the Extern section (I placed it after Function NSRun$(gadget:TNSGadget,script$))
'combo
Function NSSetComboBoxDropDownHeight(gadget:TNSGadget,num_rows:Int)

Further down the same page insert (I placed it after Method SetTabs(tabs))
	Method SetComboBoxDropDownHeight(height_in_rows:Int)
		Return NSSetComboBoxDropDownHeight(Self,height_in_rows)
	End Method

In BRL.maxgui.mod/gadget.bmx Insert near the end of the TGadget type declaration just before End Type:
'combobox
?macos
	Method SetComboBoxDropDownHeight(num_rows)
	End Method
?macos

And finally at the end of the TProxyGadget Type, just before the End Type Insert
' combo box
?macos
	Method SetComboBoxDropDownHeight(num_rows:Int)
		Return proxy.SetComboBoxDropDownHeight(num_rows)
	End Method
?macos


I'm not sure if the proxy gadget insert was needed. Anyone?

To use - in this instance setting display to 20 rows:

		Local ComboBox:TGadget
	
		'	Create the ComboBox
		ComboBox = CreateComboBox(_rect.x,_rect.y,_rect.w,_rect.h,_parent_gadget,_style)

		'	ComboBox ok?
		If ComboBox = Null Throw "ComboBox::Create:TComboBox - NULL ComboBox"
				
		ComboBox.SetComboBoxDropDownHeight(20)	



Note setting a height of 20 rows won't actually display a box 20 high unless you have 20+ items in it!

[Woops! just realised this probably belongs in ModuleTweaks]

- David