how to stop mouse clicks from executing?

Peter M. Brigham pmbrig at gmail.com
Tue Sep 2 08:12:12 EDT 2014


On Sep 1, 2014, at 3:50 PM, <larry at significantplanet.org> <larry at significantplanet.org> wrote:

> Hi Paul,
> As Richmond says, "That's a clever idea."
> However, I have no understanding of what a frontScript is and no understanding of how to trap those events.
> Perhaps you'd be willing to elaborate for me?

Create a button with the following script:

on mousedown
   if <put your conditions here> then
      -- block mousedown
   else
      pass mousedown
   end if
end mousedown

on mouseup
   if <put your conditions here> then
      -- block mouseup
   else
      pass mouseup
   end if
end mouseup

Then in an openstack handler put the following line:
   insert script of btn "myFrontScript" into front

A front script resides at the very front of the message path, and all messages will pass to it before going to any controls, cards, or stacks. Anything not handled by the frontscript will then pass to the normal message path. Any message blocked by the frontscript will stop there without getting passed. Frontscripts are very useful for handling special actions that must prevail everywhere in your stack.

In most cases you will want to be sure to put the following in your closestack handler:
   remove script of btn "myFrontScript" from front
to be sure that your blocking action does not persist when it is not needed.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list