Page 1 of 1

textSize of stack

Posted: Sun Jun 14, 2020 10:58 pm
by anmldr
I am exploring the LiveCode Scripting Conferences. From what I have seen so far, most of the text in fields are formatted text and have very small fonts. I have difficulty reading them. I thought that I would just set the textSize of the stack to 18 or 20 in the preOpenStack. But due to the direction of messages, of course, this did not work on the textSize set at a lower level in the message path. It does work on the controls that the text size was not specifically set by the stacks creators. Is there a way (perhaps the messageBox) to change the textSize, other than visiting every control and setting it's textSize? I already understand that in many places, like labels, this will look funky. It is the info in the scripting conferences that is important for my learning and not the visuals of the stacks.

I used this and it worked on portions of the stacks:

Code: Select all

on preOpenStack
   set the textSize of this stack to 18
end preOpenStack
I also tried using the search feature of the IDE. I searched for "textSize" and the only position that is found is the above preOpenStack that I added myself. The creators of the stacks must have used the property inspectors to set the text size instead of hard coding it.

Thank you,
Linda

Re: textSize of stack

Posted: Mon Jun 15, 2020 12:06 am
by dunbarx
Hi.

If you set the textSize of a stack, that stack becomes the owner of any controls in it, and each will inherit that value unless they are explicitly set to something else. This is because every newly created control has a default textSize of empty, and an empty value will follow the owner, that is, the stack.

So if you do set the stack textSize, and want to change that property among certain controls, you will indeed have to do so one by one. You can certainly do this in a loop, providing there is some identifying property you can use to identify the controls of interest. For example, say you had 100 fields, but the ones you want to have a different textSize all had an "X" in their name. Like fld "aax", "bb", "ccx", "dd",... Then:

Code: Select all

repeat with y = 1 to the number of flds
  if the last char of the name of fld y = "x" then set the textSize of fld y to 12
end repeat
You can, of course, do this the opposite way, let the default textsize alone and change only those of interest to 24.

Or whatever. But why are you presetting the textSize of the stack if you know you will want to then change lots of controls? And if there are only a few that need their own value, then just do so by hand.

Craig

Re: textSize of stack

Posted: Mon Jun 15, 2020 12:14 am
by dunbarx
Here is another way. Group the controls of interest (these can be of any kind, like buttons and fields) and set the textSize of the group. Then even if you ungroup them all, each control will retain that value. This is a more "hands on" method than a loop.

Craig

Re: textSize of stack

Posted: Mon Jun 15, 2020 12:45 am
by anmldr
dunbarx wrote:
Mon Jun 15, 2020 12:06 am
But why are you presetting the textSize of the stack if you know you will want to then change lots of controls?
The presetting was only a test and then I realized that I had the message path "upside down" in that if a control has it specifically set then it does not inherit from the stack. It was a mistake that I quickly realized. I wanted to show that I was trying and not just sucking info from the forum members.
And if there are only a few that need their own value, then just do so by hand.
Sorry if I was not clear. I am going through a lot of the LiveCode Scripting Conference stacks. I don't want to go to every script or every property of every control on every card of those stacks just to change the text size. I was hoping that I could load a stack into LC and then have a script that I could place once in the stack somewhere, either in say the preOpenStack or in the Message Box that would alter the textSize within a stack. Do it once, save it and "ta da!" magic, I could then read more comfortably.

Linda

Re: textSize of stack

Posted: Mon Jun 15, 2020 1:28 am
by ClipArtGuy
I am not near a computer at the moment, but setting the scalefactor of the stacks might make them easier to read.

https://livecode.fandom.com/wiki/ScaleFactor

Re: textSize of stack

Posted: Mon Jun 15, 2020 4:58 am
by dunbarx
Don't worry about not being clear. I never am.

You can easily write a handler that will go through all the things you mentioned: (pseudo)

Code: Select all

on mouseUp
  repeat with x = 1 to the number of lines of the openStacks
    repeat with y = 1 to the number of cds of stack line x of the openStacks
      repeat with u = 1 to the number of controls of cd y of stack line x of the openStacks
        set the textSize of control u of cd y of stack line x of the openStacks to 12
      end repeat
    end repeat
  end repeat
end mouseUp
This is "pseudo" because the "openStacks" has more in it than you want. I included it only to introduce it. You probably want to make your own stack list, and use that.

Craig

Re: textSize of stack

Posted: Mon Jun 15, 2020 6:49 am
by anmldr
I have not tried yours yet Craig. Perhaps tomorrow. Thanks.

ClipArt, yours worked great! I thank you for that.

Linda