Resizestack: sending and passing problem

Mark Schonewille m.schonewille at economy-x-talk.com
Wed Oct 11 17:29:51 CDT 2006


Hi David,

The correct way is to create a resizeStack handler like this:

on resizeStack
   modResizeStack
   pass resizeStack
end resizeStack

on modResizeStack
   -- do stuff here
end modResizeStack

and a button would contain a script like

on mouseUp
   modResizeStack
end mouseUp

Now, you can call the modResizeStack handler without worrying about  
an error. If the only reason for passing the resizeStack message is  
you using the geometry manager, you don't really need to pass the  
resizeStack message and the following would be sufficient:

on resizeStack
   revUpdategeometry
   -- do stuff here
end resizeStack

Now you could safely call the resizeStack handler using

on mouseUp
   resizeStack
end mouseUp

If you don't want to change your scripts at the risk of breaking  
them, you can prevent the error from popping up by means of a try  
control structure:

on mouseUp
   try
     resizestack
   end try
end mouseUp

As a rule, all message send by a script, need to be handled in  
another script. Messages that are triggered by an event, such as an  
actual mouseClick or mouseMove, can go unhandled. (This is different  
from HyperCard, where all messages recognised as valid HyperTalk can  
go unhandled).

Best,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Get your store on-line within minutes with Salery Web Store software.  
Download at http://www.salery.biz

Op 11-okt-2006, om 23:57 heeft David Bovill het volgende geschreven:

> Spent hours trying to track this down...
>
>  send "resizeStack" to card 1
>
> Could not get it to work.
>
> Then tried this. Create a blank stack - on the card script add:
>
> on mouseUp
>    beep
>    pass mouseUp
> end mouseUp
>
> And put an empty button on a card. Clicking on the button gives you  
> a very
> pleasing beep. But put this script in the button:
>
> on mouseUp
>    send "mouseUp" to card 1
> end mouseUp
>
> And you get an error! Remove the "pass mouseUp" from the card  
> script and
> everything works.
>
> OK - so my problem is how do you send "resizeStack" messages. I  
> don"t want
> to not pass this message?





More information about the use-livecode mailing list