Forum > Carbon

Why are TButtons square?

<< < (2/4) > >>


--- Quote from: Frederick on February 21, 2011, 07:22:30 pm ---I'm trying out the TButton options and have a few more questions.

I figured out that:
Setting Cancel = true allows pressing Esc to trigger the button action.
Setting TabOrder = 0 allows pressing Enter to trigger the action.

But don't understand:
Is there a way to highlight the default button? It is normally blue in OS X.

--- End quote ---
I noticed that also, but haven't gotten around to looking at it.

--- Quote from: Frederick on February 21, 2011, 07:22:30 pm ---Is it possible to set the font size? I can't do it.
The default button font, I'm guessing Lucida Grande 12, is not centered correctly. It is several pixels too far up. Is there a way to center it or set the baseline?

--- End quote ---

You should be able to set the font and font size.

I'm not sure what default font the Carbon widgetset uses, but setting the size correctly should center it okay. Are you talking about font Height or Size? In my app, Height=-13 vertically centers nicely when Lucida Grande is used - Lucida Grande is the one to use on Mac.

With my app, I run a script that converts the forms to eliminate some of the Lazarus non-standard behavior. It uses the DfmToLfm converter from the XDev Toollkit. This converter can also convert .lfm to .lfm too. The idea here, as I outlined in the article, is that you have two sets of forms. One set is what you design with, perhaps Windows if that's where you start. Then any time you make a change to a form there, you convert the forms to a different set used on Mac. They can have a different name if you want to keep them separate to avoid confusion.

So if you convert a form with the converter's -m -s switches, it will also do font substitution to make sure you're using Lucida Grande or other Mac fonts instead of typical MS Sans Serif or Arial that is often used on Windows.



I had left the Font Name = default. If I change it to Name = Lucida Grande, I can indeed change the Height. Thanks.

Oddly, there is a difference in the vertical centering between TButton and TBitBtn. The text is vertically centered in a TBitBtn, but is too high in a TButton. I will just use a TBitBtn, but perhaps I should report it as a cosmetic bug.

I have tried setting TBitBtn.Default = true, and thought it might highlight the default button, but it doesn't. Maybe I should submit this as a request?

I'm still figuring out Lazarus and pretty sure I will eventually port three applications from REALbasic. I'm slowing migrating one now on OS X, but will need to figure out Windows as well if I am to do all three. Your article is helpful, and I'm trying to build in conditional compiles as I go. Maybe I will need multiple forms as well.

Thanks Phil

I just discovered that setting TBitBtn.Kind = bkOK results in a "OK" button glyph with a green checkmark. It would be nice if it were a blue Mac Aqua button, but maybe that is asking too much.

ShowGlyphMode is probably what you need to modify.


--- Quote from: vvzh on February 21, 2011, 09:16:54 pm ---ShowGlyphMode is probably what you need to modify.

--- End quote ---

No, he doesn't want a glyph.

Did you read the link you cite? See the bottom comment about glyphs on Mac.




[0] Message Index

[#] Next page

[*] Previous page

Go to full version