Combobox dropdown height
BlitzMax Forums/MaxGUI Module/Combobox dropdown height
| ||
Is there any way to adjust the height of the drop-down list of a combobox? It's not very easy to navigate a tiny little drop-down box if you have a lot of items stored in it. |
| ||
try this:Local combohwnd=SendMessageA(QueryGadget(combobox,QUERY_HWND),CBEM_GETCOMBOCONTROL,0,0 ); SetWindowPos combohwnd,0,0,0,120,400,SWP_NOMOVE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOACTIVATE |
| ||
It works, thank you. |
| ||
Where does SendMessageA live? I'm trying skid's code above in OSX without success. I hope it's not windows only? thanks David |
| ||
Yea, its Windows |
| ||
Ha and I thought I was the only one missing such a command/ flag for the combobox. |
| ||
Hmmm. Is this on our update wishlist then? Seems like it would only be a small change to the MaxGUI code, as they are already setting the default height somewhere? It's a fairly big deal for me as I'm midway through a very GUI-driven app; which was meant to be cross-platform (the reason I selected BlitzMax in the first place) and the current combo height on OSX will make navigation too painful for users - and yet there seems no alternate gadget I can use given my space requirements. I'd say it's close to a disaster for me actually. What's the chance of this changing I wonder? Thanks David |
| ||
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 |