Forum > LCL

ComboBox height can't be made larger than 20 on intel Mac

(1/2) > >>

Frogfather:
Morning!

As the title says, I'm trying to adjust the height of a combo box either by altering the font size with auto size = true, manually by adjusting it on the form designer or programmatically by setting (e.g.) cb1.height:=30;

In all cases it doesn't seem possible to make the height larger than 20.

The text size does correspond to the font.height or font.size settings but as the actual control doesn't resize larger text is clipped by the bounds of the control.

MacBook pro 2018
MacOs Ventura 13.6
FPC 3.2.2
Lazarus: 2.2.6

Screenshot shows box with autosize off and font height = 36px

Joanna:
You might be able to use constraints to change the min and max height of the combobox

Frogfather:
Hi Joanna,

Thanks for the quick reply. Unfortunately that doesn't work and after a little investigation I see the same behaviour is exhibited by other similar controls (TEdit, TMaskEdit etc)

Here's the observed behaviour with constraints:

Set min width: control resizes (expected)
Set min width back to 0: control stays same size (expected)
Set min height to > 20: Control stays at 20 (oops)
Set max height to < 20: control resizes to new value (expected)
Set max height back to 0: control resizes to 20 (not expected)

Same behaviour with anchors - width resizes correctly but height doesn't.
Same behaviour programmatically setting height and width.
Same behaviour editing the lfm file.

I'll try with Windows and Linux later if I have time but suspect they'll work OK since if this was a common issue someone else would have noticed before now.

Btw I'm happy to investigate myself if someone can point me to the section of the codebase that handles resizing controls.

Cheers

John

Joanna:
Here is how I do it in my tcontrol helper, the code will work for many types of controls.
When the size of the text changes I call this procedure.
This might not be the best solution but it works for me  8)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---PROCEDURE TCONTROL_HELPER.CONSTRAIN_HT( CONST AHEIGHT: INTEGER) ;BEGIN IF AHEIGHT < 0 THEN exitWITH Constraints DO     BEGIN     MinHeight := AHEIGHT;     MaxHeight := AHEIGHT;     END;Height:= AHEIGHT; // height is not guaranteed to change sometimes unless explicitly set. END;  

Frogfather:
Hi Joanna,

I've checked on a Windows machine and as I suspected the issue does not occur on Windows. I'll hazard a guess it's mac only but I haven't had time to try on either my m1 work machine or my Linux machine.

I don't know the details of how the ide communicates with the underlying apple widgets but it seems that any request to increase the height beyond 20 either by altering the setting in the object inspector or programmatically is simply ignored.

Thanks for your help anyway :)

Navigation

[0] Message Index

[#] Next page

Go to full version