More drawing tool woes: no mouseDown or mouseUp sent?
Dave Cragg
dcragg at lacscentre.co.uk
Sat Sep 10 05:45:09 EDT 2005
On 10 Sep 2005, at 08:37, Richard Gaskin wrote:
> I'm making a specialized drawing tool, and I need to know when the
> mouse is clicked outside of any control while the pointer tool is
> active -- here's my setup:
>
> The card has a group which is used as the drawing region. I also
> have another group which is used for tools, and the cantSelect of
> those tool buttons is set to true in order to have them behave like
> the browse tool when the pointer tool is active.
>
> Some of the objects in my drawing region group are selectable as
> normal, and others have their cantSelect set to true as they're
> mostly managed by script in response to things the user does with
> the selectable objects.
>
> When the user clicks on one of these non-selectable objects I
> change its appearance to indicate that it's selected.
>
> Now here's the challenge: When the user clicks off of any control
> I need notification so I can change the appearance of those objects.
>
> We get this behavior for free with normally selectable objects:
> you click on it and it's selected, you click off of it and it's
> deselected.
>
> But in order to manage my non-selectable objects, I need to know
> when the mouse is clicked anywhere outside of a control.
>
> Apparently the mouseDown and mouseUp messages are not sent when the
> pointer tool is active unless the user clicks with button 3; the
> normal button 1 click never sends the message to the card. Unlike
> SuperCard, we have no pointerDown or pointerUp message which would
> make this a snap.
>
> I've tried placing a graphic object at the back of my group to trap
> messages like that, but if I leave it with the cantSelect off it's
> selectable, and if I turn on the cantSelect then dragging on it
> gives the browse tool behavior rather than the pointer tool
> behavior of the selection marquee. Suppporting the normal behavior
> of marquee selection is important and I don't want to sacrifice it
> just to work around the lack of mouseDown or mouseUp.
>
> Any other suggestions for identifying when the user clicks outside
> of any control on a card while the pointer tool is active?
Is there any way of using a "dummy object" (perhaps off screen) that
you select by script when you set the appearance of the non-
selectable objects. Then when you click off the control, you could
trap for a selectedObjectChanged message as the "dummy object" is
unselected. (I haven't thought this through at all. No doubt it's
full of holes.)
Cheers
Dave
More information about the use-livecode
mailing list