Moving a window without a dragbar...

Ken Ray kray at sonsothunder.com
Tue Dec 4 02:26:01 EST 2001


Chipp,

Here's how it works:

You create an object to hold a script (I usually use a button, but you can
use anything) that you are going to insert into the "front" of the message
passing hierarchy. Let's call this button "FS" (for "frontScript") and for
ease of coding, place it on the window that needs to trap the messages. When
your window opens, you use this code:

on preOpenCard
    insert the script of btn "FS" into front
end preOpenCard

Button "FS" has all your 'mouseDown', 'mouseUp', 'mouseMove', etc. code

What happens is that normally, when you click on a card object, the message
gets processed in the following order:

  Card Object -> Card -> Group -> Stack

Inserting a frontScript puts it *in front* of the objects on the card, so
the new message hierarchy after inserting the script of btn "FS" is as
follows:

  Button "FS" -> Card Object -> Card -> Group -> Stack

You can have multiple frontScripts; each new one is placed "in front" of all
the others. For example, if I had another button "FS2" that I inserted next,
the hierarchy would be:

  Button "FS2" -> Button "FS" -> Card Object -> Card -> Group -> Stack

Messages will not proceed up the hierarchy without being explicitly passed.
So in order for the buttons on your window to work (assuming they have code
in them), you'll need to "pass" the message after you're done moving the
window.

Hope this is clear; if not, let me know.

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/


----- Original Message -----
From: "Chipp Walters" <chipp at chipp.com>
To: <use-revolution at lists.runrev.com>
Sent: Tuesday, December 04, 2001 12:59 AM
Subject: RE: Moving a window without a dragbar...


> Ken,
>
> Not sure ?HOW? to use a frontscript. Can you explain? thx
>
> -Chipp
>
> -----Original Message-----
> From: use-revolution-admin at lists.runrev.com
> [mailto:use-revolution-admin at lists.runrev.com]On Behalf Of Ken Ray
> Sent: Tuesday, December 04, 2001 12:15 AM
> To: use-revolution at lists.runrev.com
> Subject: Re: Moving a window without a dragbar...
>
>
> Chipp,
>
> Use a frontScript. This way, mouse messages will hit the frontScript
first,
> and won't go to the buttons (unless you explicitly pass them).
>
> Ken Ray
> Sons of Thunder Software
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
> ----- Original Message -----
> From: "Chipp Walters" <chipp at chipp.com>
> To: <use-revolution at lists.runrev.com>
> Sent: Monday, December 03, 2001 10:40 PM
> Subject: Moving a window without a dragbar...
>
>
> > I'm writing a little handler to move a window by clicking on it and
> > dragging. I've inserted the following into the stack script:
> >
> > local startX,startY,dragWd
> >
> > on mouseDown
> >   put true into dragWd
> >   put the mouseH into startX
> >   put the mouseV into startY
> > end mouseDown
> >
> > on mouseMove newMouseH, newMouseV
> >   if dragWd then
> >     set the loc of this stack to \
> > item 1 of the loc of this stack - startX + newMouseH, \
> > item 2 of the loc of this stack - startY + newMouseV
> >   end if
> > end mouseMove
> >
> > on mouseUp
> >   put false into dragWd
> > end mouseUp
> >
> > on mouseRelease
> >   put false into dragWd
> > end mouseRelease
> >
> > on mouseLeave
> >   put false into dragWd
> > end mouseLeave
> >
> > This way you can build a project with no window borders or titlebar, and
> > have it still be dragged around the screen. How can I get buttons to not
> > react to the handlers above without explicitly coding "catch" handlers?
> >
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list