changing btn names at the stack level?

Jim Ault JimAultWins at yahoo.com
Wed Mar 29 15:19:33 EST 2006


Two questions before the renaming...

Why would you name buttons as a numeral, since this will confuse the
references to the buttons?

button 1 is not the same as button "1"

Why would you name the buttons the same name (either numeral or other),
which would make referencing even more problematic?


Try this example, by pasting it into the stack script, then typing "test"
into the msg box, then hit enter
------------------------------------
on test
  --this will set the custom property of each button to 1 or 0
  --you can use any legal name you want for customInteger
  
  put "" into ouput
  repeat with x = 1 to the number of controls
    if the name of control x contains "button" then
      if the label of control x is "YES" then
        set the customInteger of control x to 1
      else if the label of control x is "NO" then
        set the customInteger of control x to 0
      end if
      put the label of control x && \
          the customInteger of control x into line x of output
    end if
  end repeat
  answer "You have been obeyed" &cr & output
end test
-----------------------------------

Jim Ault
Las Vegas



On 3/29/06 10:44 AM, "Ben Bock" <benbock at msn.com> wrote:

> I have a 15 card stack with 31 buttons per page (15 yes, 15 no, 1 Go next
> card).  When I made this stack I screw up and did not name the buttons when
> copy& pasting them.  I want the YES label buttons to be named "1" and the NO
> label buttons named "0".  Can I do this with a script, preferably at the stack
> level?
> 
> My current effort is at the card level:
> 
> on openCard
> 
>     put the number of btns into btnCount
> 
>   repeat with x = 1 to btnCount
> 
>     put the label of btn x into labelList
> 
>     repeat for each line tGroup in labelList
> 
>       if  label of btn x is "YES" then
> 
>         set the Name of btn label tGroup of cd x to "1"
> 
>       end if
> 
>     end repeat
> 
>   end repeat
> 
> end openCard
> 
> 
> 
> I'm a newby to programming and Rev, & I'm learning Rev mostly from this user
> list.  If there is some dorky mistake in my attempt, please excuse and school
> me properly.
> 
> 
> Thanks
> 
> 
> 
> Ben
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the Use-livecode mailing list