Can I set the font baseline in a standard pushbutton?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Timpraetor
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9
Joined: Thu Feb 04, 2010 7:12 pm

Can I set the font baseline in a standard pushbutton?

Post by Timpraetor » Fri Feb 19, 2010 5:44 pm

In working through a number of example stacks, I've noticed that the baseline for the text displayed in a standard Mac "jellybean" pushbutton is always 2 to 3 pixels too high. Is it possible to set the baseline property in a standard pushbutton?

Also, is there any concept of the "System" and "SmallSystem" fonts so that our UI designs adhere to the themes and component sizes set by users?

Thanks,
Tim
--
Tim

Tim Jones
President / CTO
TOLIS Group, Inc.
http://www.tolisgroup.com
http://ww2.productionbackup.com

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Can I set the font baseline in a standard pushbutton?

Post by Mark » Fri Feb 19, 2010 6:37 pm

Hi TIm,

You can't set the baseline, but you can set the textHeight. Sometimes, this might help you out.

You can't change the font size of all objects at once using a System or SmallSystem textfont or textsize. There isn't even a direct way to find out the current user settings for fonts.

However, it should be possible to read the Windows registry and to find out to what value the user has set these display settings.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Can I set the font baseline in a standard pushbutton?

Post by bn » Mon Feb 22, 2010 8:40 pm

Tim,
you can set the margins of a button, this has an effect on the position of the text. The default margins of a new button are 4, that is 4 pixels left, right, top, bottom.
You can adjust the margins individually. When a new button is created (placed on a card) a newButton message is send to this button.
You could trap this message in the stack script or card script or in a library that you "start using myLibrary" or a plug-in, which is basically a library that you can start when Rev starts up.
The script would be for example

Code: Select all

on newButton
   set the bottomMargin of the target to 2
  -- you can pass the message if some other handler needs this message
  -- pass newButton -- unblock this
end newButton
There is not a global setting for this but you can tweak your button/object quite a bit with the properties.
regards
Bernd

Post Reply