Changing display size of buttons

I am a long time Xojo user, back to its RealBasic roots, but have not had to use it for some time now. I have just downloaded version 2025R1 and am trying to create a new project.

Things seem to have changed since my days as an active user.

My problem at the moment is I can not alter the display size of a desktop button. I can alter its font and height but the display size of the graphic stays the same.

Can some one please explain how this new version works for desktop icons. The help documentation is most confusing and, as for most documentation, really useful to a constant user, but not me.

bobj

i guess you clicked the gear. screenshot of a desktop project.

@MarkusR, yes I have clicked the gear icon but that only lets me change the font size not the size of the actual graphic.

Here the font is set to 20 points but the actual graphic has not been resized to fit nicely.

thanks for your feedback though.

bobj

Look at the forst screen shot, the first redarc circle, you have Position change width and height and the button size will change accordingly, unless you are not talking about DesktopButton and DesktopCanvas instead (same behavior !).

@Emile_Schwarz I have done that and as you can see from below, it changes the width of the graphic but not the height. It does change the active size of the button though.

Mac OS 15.4 XOJO 2025R1

I check and come back.

You are correct. Here’s a screen shot with larger button size, text Size = 48, backdrop window yellos to really see what is done:

macOS buttons have a fixed height. If you want larger buttons then you must make your own.

4 Likes

No§ only that, but have-you seen the text size ?
(out of the button)

@Beatrix_Willius nailed it. This is a MacOS issue, not a Xojo one. Your resized buttons would appear as you expect on Windows.

A Bevel Button will behave as you wish, but it will not have the OS native look.

1 Like

i can’t believe that SwiftUI or UIKit limit a Button Size in height.

Even in SwiftUI you have only a limited set of border sizes:

Button(“mini”) {}
.controlSize(.mini)
Button(“small”) {}
.controlSize(.small)
Button(“regular”) {}
.controlSize(.regular)
Button(“large”) {}
.controlSize(.large)

using a custom frame has no effect:

Button(“custom”) {}
.frame(width: 200, height: 80)
.border(.red.opacity(0.25), width: 3)

the latter sample shows a border of the given Rect with a standard sized button.

So macOS does not allow arbitrarily control sizes.

2 Likes

i found this about

You can use a declare to change the control size, but you are still limited to the sizes that macOS allows.

In the opening event:

Declare Sub setControlSize Lib "AppKit" Selector "setControlSize:" (obj As Ptr, size As Integer)
setControlSize(me.Handle, 3)

These are the available sizes:

Const NSControlSizeRegular = 0
Const NSControlSizeSmall = 1
Const NSControlSizeMini = 2
Const NSControlSizeLarge = 3

The large button looks like this compared to regular:

2 Likes

But, what about a DesktopButton with the Mac Button Style set to “Bevel”?

Appears to work fine with custom heights and font sizes and still inherits the native look and behaviour of the standard buttons.

Even in dark mode.

4 Likes

Thanks @Scott_C , bevel button style works a treat.

bobj

1 Like

There was never an issue using a custom button (i.e. bevel button) with any size.
The issue is that system buttons from macOS can’t have any size.

1 Like

Yes, that is what we understand.

Is there’s an Issue for that ,