Setting fonts to be different in OSX and Windows

J. Landman Gay jacque at hyperactivesw.com
Wed Dec 8 15:06:10 EST 2004


On 12/7/04 5:11 PM, Anna Shn wrote:

> Hello again! and thank you for your responses! I have some questions
> about how to actually implement your suggestions:
> 
> Jacqueline Gay, you said:
> 
>>> Another way that sometimes works is to have a handler check >>the
>>> platform that is running, and set the font size in Windows a
>>> >>bit smaller than it is on a Mac. You can do this in a
>>> >>preOpenCard handler if the changes affect only that card, or
>>> >>do it more generally in a preOpenStack handler if the changes
>>> >>need to be widespread. For example, set the textsize to 12 on
>>> >>Mac and 11 on Windows.
> 
> 
> What is preOpenCard/Stack and how do I access these items to change
> them?

OpenStack and PreOpenStack are system messages that are sent whenever a 
stack opens. You can look up these terms in the dictionary. Just as 
mouseUp is a system message that is sent whenever the user clicks the 
mouse, you can write an openStack or preOpenStack handler to catch those 
events too. Whatever commands you place into these handlers will execute 
when the stack opens.

You can also look up the "platform" function in the dictionary. This 
function tells you what OS is running. You would check the platform to 
see if your stack is running on a Windows or Mac machine, and make font 
changes as needed depending on the OS.

For example:

on preOpenStack
  put the platform into pPlat
  if pPlat = "win32" then
    set the textsize of fld 1 of cd 1 to 12
  else if pPlat = "macos" then
    set the textsize of fld 1 of cd 1 to 14
  end if
end preOpenStack

You'll want to expand the text-setting commands to match your stack 
requirements. This handler will run every time the stack opens.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list