Moving a window without a dragbar...

Chipp Walters chipp at chipp.com
Tue Dec 4 02:44:01 EST 2001


Ken,

Thanks for the excellent explanation. I'll find it valuable in the future.
But, what I'm trying to do it to NOT have the mouseDown, mouseMove, mouseUp,
mouseLeave etc.. be passed to buttons and fields so that buttons and fields
may have regular mouse functions. I can do that by putting

on mouseDown
	exit to top
end mouseDown

on mouseMove
	exit to top
end mouseMove

etc.. in each button, image and fld. Can frontscripts be somehow used?

Perhaps Jeanne's handler suggetion would be something like: (in the stack
script)

on mouseDown
	if the target contains "stack" then put true into dragWd
...

Thanks again for your help,

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 1:28 AM
To: use-revolution at lists.runrev.com
Subject: Re: Moving a window without a dragbar...


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
>

_______________________________________________
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