How to change ComboBox row height?
-
@ustk said in How to change ComboBox row height?:
@d-healey It's easy to trick if you want them bigger because you just have to paint the main CB to a smaller size.
If you use
drawComboBox
then the combo box height no longer affects the row height. -
@ustk Ok I think I understand what you're suggesting. I put the combo box in a panel and paint the panel instead of the combo box. That way the combo box can be any size and I can control the height of the rows.
-
Ah but now I can't paint a hover action because the combo box blocks the panel :(
-
I've thought of a solution. If I can programmatically make the popup menu open and close I can style everything the way I want.
@ustk @Christoph-Hart I'd like to add some functions from JUCE,
showPopup()
,hidePopup()
,isPopupActive()
. I'm either too tired or missing something obvious but within theScriptingApiContent.cpp
I add the wrapper function but how do I get a reference to the current combo box so that I can call the JUCE function on it?I tried
this->showPopup()
but of coursethis
doesn't work, is it a case of usinggetComponent()
or is there some more straightforward method? -
Ah but now I can't paint a hover action because the combo box blocks the panel
But apparently you want a thin CB with bigger rows. If the CB is inside a panel, you can always paint what you want in the CB with a custom LAF
You can also miss the panel and paint a smaller area in the CB (but then it'll react when the mouse is close)You could also go full child panels to create your drop down? Because of the current "ghost" issue?
I'd like to add some functions from JUCE, showPopup()...
If we can override those functions then it should be possible to simply add a property.
-
But apparently you want a thin CB with bigger rows.
I want the opposite. I want to increase the height.
You could also go full child panels to create your drop down? Because of the current "ghost" issue?
I don't even need child panels for this. I just don't want to do it :)
If we can override those functions then it should be possible to simply add a property.
I was thinking of adding scripting wrappers for the functions. How would they work as properties?
-
I was thinking of adding scripting wrappers for the functions. How would they work as properties?
Once you create a property for the height, you might be able to pass it to the function when the property changes.
I was trying to fake a smaller CB with bigger rows, and realised that once you set a custom LAF, the row height get back to a default value no matter the height of the CB...
There might be a way to access this in the local LAF function -
There might be a way to access this in the local LAF function
I couldn't find a way. But with programatic showPopup/hidePopup we can do whatever we want.
-
@ustk said in How to change ComboBox row height?:
Once you create a property for the height, you might be able to pass it to the function when the property changes.
Let me know if you solve it because having a row height property would be the best solution.
-
@ustk I think I'm getting somewhere.
@Christoph-Hart Can you explain this? https://github.com/christophhart/HISE/blob/develop/hi_core/hi_core/MacroControlledComponents.h#L375
Setting it to 1 will allow the overridden
showPopup()
function to work and in there we have access to the row height property on line 408:withStandardItemHeight()
-
@d-healey Nice one, there's the showPopup override here I was looking for! I'm sure my eyes slipped over it hundreds of times...
-
@ustk I've added the property, the last thing to do is get the property into the showPopup function. I'd also like to know why Christoph is using the
#if
... -
@d-healey Nice!
If you struggle with the property I'll be back tomorrow to help... -
@ustk Yeah I'm giving up on it for today. I'll wait for you :) Just need to figure out how to pass the property from the ScriptComboBox to HiComboBox
-
@d-healey that is the hard part I'm not sure how to do…
-
@d-healey please share the branch with me so I can have a look tomorrow git -> ustk
-
-
Any hints @Christoph-Hart ?
-
Yeah, this is one of a classic case of "Too late to the party and too lazy to catch up"...
But adding a
showPopup()
method is not as easy as it looks because there is a strict decoupling of the scripting objects that are representing a UI element and the actual element (because the actual UI element has a much shorter lifespan and can exist multiple times).A much more simple approach would be using this method:
and add a scripting layer to access it through a LAF object.
-
Wrong link, I meant the
getIdealPopupMenuItemSize
a little bit above...