Target controls on a card that are *not* part of a placed groups

Sannyasin Brahmanathaswami brahma at hindu.org
Sun Mar 6 05:54:18 CET 2016


 
I'm trying to customize some development tools. A typical use case it to be able to change the button style of all the buttons on a card, but I don't want to touch the style of buttons that are part of top and bottom nav bars that are placed on all cards.  I need to be able to go into a review process and if someone says "Let's see what it looks like if we change the buttons to look like XYZ"

I have this in a field of a tools stack:

backgroundcolor|65,65,65
ink|blendHardLight
opaque|true

and a button with this script

on mouseUp

put fld "buttonProps" into tButtonProps
split tButtonProps with cr and "|"
set the defaultStack to the topstack
repeat with x = 1 to (the number of buttons of this card)
# what I really want to do here is skip all the buttons that are in groups
# which are placed on all card (or more than one card
   repeat for each key y in tButtonProps
     set the y of btn x of this card to tButtonProps[y]
   end repeat
end repeat

end mouseUp

If you have a better way to tackle this.. it's something I've worked with for years and never came up with an easy solution. 

I also like the idea of selecting the buttons... then I can use this

on mouseUp

   put fld "buttonProps" into tButtonProps
   split tButtonProps with cr and "|"
   set the defaultStack to the topstack
   put the number of lines of (the selectedObjects) into tObjects
   if tObjects = 0 then 
      answer "Please select some controls" with "OK"
      exit to top
   end if
   
   repeat for each line x in (the selectedObjects)
      repeat for each key y in tButtonProps
         set the y of x to tButtonProps[y]
      end repeat
   end repeat
   
end mouseUp

Anyone have an even more efficient method? How do you handle this?

BR












More information about the use-livecode mailing list