Sending mouseup to checkboxes on different card

Klaus on-rev klaus at major.on-rev.com
Wed Oct 20 12:04:40 EDT 2010


Hi Charles,

> Robert,
> 
> I tried your suggestion. But I get the same results: the checkboxes received the message on the first card but the checkboxes on the second card did not receive the mouseUp message. 
> 
> Charles Szasz
> cszasz at mac.com

your script is OK!
But check Roberts answer, that is what's going on on your side!

>> ...
>> Anyway, your script may fail if your mouseup function does sth that 
>> refers to the buttons on the other card, which are not present on the 
>> current card and it does not make full reference to them but only 
>> uses short names. 

To avoid this and other traps when sending "mouseup" to object on other cards you coul do this and
since there is no "defaultCard" (like "defaultstack") that we can set, we have to go to all the cards to 
avoid this above mentioned phenomenon!

on mouseUp
 ## We want to return to this card after the script has finished!
 put the num of this cd into tStartCard
 lock screen
  repeat with y = 1 to the number of cards
  
  ## We actually have to GO to the cards but to avoid unnecessary
  ## PRE/OPENCARD messages we have to:
 lock messages
 go cd y
 unlock messages
     repeat with b= 1 to the number of buttons
        if the style of button b  = "checkbox" then
           if the hilite of button b  = "true" then 
               send "mouseUp" to button b
           end if
       end if
     end repeat
end repeat

## Go back
 lock messages
 go cd tStartCard
 unlock messages
 unlock screen
end mouseUp

>> 
>> Robert 

Best

Klaus

--
Klaus Major
http://www.major-k.de
klaus at major.on-rev.com




More information about the Use-livecode mailing list