capsLockKey Message?

Sarah Reichelt sarah.reichelt at gmail.com
Fri Mar 24 19:53:08 EST 2006


> I see no message for such things as the caps lock, num lock and scroll
> lock keys.
>
> Does anyone know of a way to get a message from these?  Or will I need
> to setup some loop in the stack to test the functions for the results?
>
> If loop, what and how is a loop setup in the stack that won't bog down
> the cpu, and allows everything else to flow as intended?

I can't see anything that checks numlock or scroll lock, but you can
check "the capsLockKey" to see if it is up or down.

Set up a loop like this:

on checkCaps
    if the capsLockKey = "down" then put "Capslock ON"
    else put "Capslock OFF"

    if the pendingMessages contains "checkCaps" is false then
        send checkCaps to me in 10 ticks
    end if
end checkCaps

What I do is alter the repeat time (set to 10 ticks or 1/6th of a
second above) until it is just fast enough. That way you aren't taking
more of the processor time that you need.

Don't forget to have a way to cancel the message when quitting or when
it is no longer needed.
Here is my general message cancel handler:

on cancelMessage pMsg
    put the pendingMessages into tList
    repeat for each line L in tList
        if item 3 of L contains pMsg then cancel item 1 of L
    end repeat
end cancelMessage

Cheers,
Sarah



More information about the Use-livecode mailing list