More drawing tool woes: no mouseDown or mouseUp sent?

MisterX b.xavier at internet.lu
Sat Sep 10 04:10:03 EDT 2005


Richard,

Can't you set up either 

A frontscript that traps mousedown and up before your controls...
this front scripts remembers where that happened and passes it or
treats the value...

An alternative is to have a card framework that does all the events instead
of having the controls in the card relay the events. It would give you more
control i believe - not the best way to program rev though, it's still
"legal!"

or

a function like 

function mymousestatus
  get the mouse is down, the target, the mouseloc, etc...
  return it
end mymousestatus

which you put in your event loop or the repeat while the mouse is up loop...

This trick saved my spellchecherks' invisible bugs...

I noticed yesterday that if a menu has a mousedown, mouseup and menupick
handlers, when the user releases the menu or mouse out the button, the
mouseup is not noticed even though the button is the focused
object/target... This is that fine line where GUI and HIGs clash though ;)

Hope that helps
Xavier

> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com 
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of 
> Richard Gaskin
> Sent: Saturday, September 10, 2005 09:37
> To: How to use Revolution
> Subject: More drawing tool woes: no mouseDown or mouseUp sent?
> 
> 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?
> 
> This sort of thing is a 15-minute job in SuperCard, now on my 
> third month in Rev....
> 
> --
>   Richard Gaskin
>   Fourth World Media Corporation
>   __________________________________________________
>   Rev tools and more: http://www.fourthworld.com/rev 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage 
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list