How to change cursor with ctrl and shift?

Jerry Daniels jerry at daniels-mara.com
Mon Jan 14 17:03:53 EST 2008


Sakari,

If you want to change the cursor anytime a modifier key is depressed  
on both Windows and Mac, then I believe you will have to use either a  
polling method (send in time), idle message or mouseWithin--none of  
which are very processor friendly and can interfere with other things  
like clicking links.

HOWEVER...if you are developing for Windows only, then you are in  
luck. ANYTIME you depress a mod key, the rawKeydown message is sent.  
This may also be so for Linux, but I have not tested that.

I would dearly love to have the ability to check mod keys anytime via  
rawkeydown message on Mac as well, but, at least in my tests over the  
years, this is not yet possible. As anyone who has developed a  
standalone application knows, there is an "event loop" that spawns  
things like the idle message and mousewithin message that Rev has. I  
am baffled why it is so hard to send a message anytime any key is  
depressed from within the Revolution engine. How could the Mac OS  
forbid such a thing. It never used to when I worked on apps in C and  
Pascal on Mac OS 7.

We check mod keys for no-click inspection in GLX2, so I think I  
understand the exercise. We need to know mod key states even if the  
mouse is not within rect of the stack as well. So we check the mod key  
states while the mouse is moving and then send a series of "staggered"  
messages every 350 millisecs after the mouse stops moving to catch  
modifier key states outside of the stack window, etc. This taxes our  
processor time very, very little and provides almost zero interference  
with the IDE's other tasks, fortunately. But it is certainly not ideal  
as the staggered messages die out after a few seconds.

Best,

Jerry Daniels

Daniels & Mara, Inc.
Makers of GLX2
http://www.daniels-mara.com/glx2



On Jan 14, 2008, at 2:40 PM, Jan Schenkel wrote:

> --- Sakari Ruoho <sakari.ruoho at academica.com> wrote:
>> Hello folks,
>>
>> Was wondering how to change the mouse cursor
>> behavior, when user
>> presses either ctrl or shift key? Like in photoshop
>> with select tool
>> where u can add to selection by pressing shift and
>> remove from
>> selection by pressing ctrl? If anyone has
>> implemented anything like
>> this, any help would be appreaciated. Thank you!
>>
>> Sakari Ruoho
>>
>
> Hi Sakari,
>
> Others already suggested trapping the 'mouseWithin'
> message, or polling every 100 milliseconds using a
> 'send in time' construct; here's a different approach:
>
> ##
>
> local sKeysDown
>
> on rawKeyDown pKey
>  if the keysDown is not sKeysDown then RefreshCursor
>  pass rawKeyDown
> end rawKeyDown
>
> on rawKeyUp pKey
>  if the keysDown is not sKeysDown then RefreshCursor
>  pass rawKeyUp
> end rawKeyUp
>
> on RefreshCursor
>  put the keysDown into sKeysDown
>  if the controlKey is down then
>    set the defaultCursor to hand
>  else
>    set the defaultCursor to arrow
>  end if
> end RefreshCursor
>
> ##
>
> Hope this helped,
>
> Jan Schenkel.
>
> Quartam Reports & PDF Library for Revolution
> <http://www.quartam.com>
>
> =====
> "As we grow older, we grow both wiser and more foolish at the same  
> time."  (La Rochefoucauld)
>
>
>       
> ____________________________________________________________________________________
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> _______________________________________________
> 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