Set all the fields properties on a single instruction

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Hery
Posts: 2
Joined: Fri Jul 15, 2016 4:51 pm

Set all the fields properties on a single instruction

Post by Hery » Fri Jul 15, 2016 5:00 pm

Do you know if is possible to set all the fields properties on a single instruction.
I need something like that:

"Set the textSize of all fields to 12"

Thanks a lot

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Set all the fields properties on a single instruction

Post by FourthWorld » Fri Jul 15, 2016 5:10 pm

If you leave the textSize of the fields to empty, setting the textSize of their parent object will set the size of all objects within it. If the parent object is a card it will affect all objects which don't have their textSize set, so if there are buttons or other controls you want with a different size perhaps you could put your fields in a group and then set the group's textSize.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Set all the fields properties on a single instruction

Post by dunbarx » Fri Jul 15, 2016 6:11 pm

What Richard said.

Know that if you have a single field with special properties, there is a property called, er, the "properties". Setting the properties of all your fields to the "properties" of a special field will do just that. This may go too far. For example, the rects of all those fields will also be set, so they will all overlie each other.

You do know about the "templateField", right?

Otherwise you can make a list of specific properties, store that somewhere, and loop through that list, setting as you go. Each line might have a property and a value, like "textFont,Geneva".

Something like(pseudo)

Code: Select all

repeat with y = 1 to the number of flds
  if fld y is a field you want to deal with then
    repeat with u = 1 to the number of lines of specialPropertiesYouListed
      set the item 1 of line u of that list of fld y  to item 2 of line u of that list --may need "do"

I said it was pseudo. You may need a "do" contraction in that handler; you will have to check. Should be a hoot to implement.

Craig Newman

Hery
Posts: 2
Joined: Fri Jul 15, 2016 4:51 pm

Re: Set all the fields properties on a single instruction

Post by Hery » Sat Jul 16, 2016 6:19 pm

Thanks to all. I'm doing some test :)

Post Reply