go first marked card command

J. Landman Gay jacque at hyperactivesw.com
Sat Oct 31 13:59:05 EDT 2009


charles61 wrote:
> I am using Rev Studio (4.0.0-DP-4-build 910) for Mac. There are 31 cards in
> my project. I have a series of checkboxes,. Each had code to similar to
> this:
> 
> on mouseUp
>    if hilite of button "check1" = true
>    then
>       mark card "AAA"
>       mark card "AAA2"
>       mark card "AAA3"
>       mark card "AAA4"
>       mark card "AAA5"
>    else
>       unmark card "AAA"
>       unmark card "AAA2"
>       unmark card "AAA3"
>       unmark card "AAA4"
>       unmark card "AAA5"
>    end if
> end mouseUp

As an aside, here's a more compact way to do the same thing:

on mouseUp
  unmark all cds
  put the hilite of btn "check1" into bool -- will be true or false
  repeat for each item i in "AAA,AAA2,AAA3,AAA4,AAA5"
     set the marked of cd i to bool
  end repeat
end mouseUp

You could get fancy and cover both buttons with the same handler:

on mouseUp
  unmark all cds
  if the hilite of btn "check1"
   then put "AAA,AAA2,AAA3,AAA4,AAA5" into tCds
  else if the hilite of btn "check2"
   then put "BBB,BBB2,BBB3,BBB4,BBB5" into tCds
   repeat for each item i in tCds
     set the marked of cd i to bool
   end repeat
end mouseUp
-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list