How to change ComboBox row height?
-
@d-healey I believe so. Check out the SubPreset tutorial. I think that has full combo customization of I'm remembering correctly.
-
@dustbro Just looks like a standard combobox to me
-
Ah I've just realised the row height is adjusted based on the height of the component. That's annoying.
-
@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. But if you need the rows to be smaller, then you can place the CB inside a bigger panel. Not ideal but...
I needed to adjust the row height myself, because I have some stuff to paint along with a long string.
It would be cool to have a rowHeight property factor that multiplies the component height.I added a property to a component a while ago but I don't remember how I did it. I'll try to dig into this...
-
Well... After adding the property I can't seem to find a way to override the Juce popup.
It seems to be a fixed size apparently, where it always uses the height of the CB label... -
@ustk Yeah I had a look in the source as well and couldn't figure it out.
-
@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