Handling Key Messages

Gregory Lypny gregory.lypny at videotron.ca
Fri Jul 28 16:23:18 EDT 2006


Thanks Dar,

I suspects this will solve a couple of script problems I've been having.

Regards,

	Gregory


On Fri, Jul 28, 2006, at 1:00 PM, use-revolution- 
request at lists.runrev.com wrote:

> Message: 9
> Date: Fri, 28 Jul 2006 10:45:36 -0600
> From: Dar Scott <dsc at swcp.com>
> Subject: Re: Handling Key Messages
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <8B6E6A5A-71A5-4C20-A9AC-45847976E07E at swcp.com>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>
> On Jul 28, 2006, at 6:52 AM, Gregory Lypny wrote:
>
>> (On a related issue, why is it that I get an error [can't find the
>> handler] when I try to send an EnterInField or similar message to a
>> field?)
>
> First possibility:  A 'send' without the 'in' time clause is assumed
> to require that a handler is in the path.  A 'send' with that clause
> is queued into pending messages and dropped into the message path
> some time later.  That will not generate the error.  So, if there is
> a potential that the handler has not been defined in a script in the
> path from the field down, use send in time.
>
> Second possibility:  I have sent messages to objects that were the
> same name as GUI event generated messages expecting the engine at the
> end of the message path to process it.  After all, I can define a
> handler for an event message and then pass it--what is the ultimate
> that does the work, but just beyond the end of the message path?  I
> have concluded that I am mistaken.  For example I can't do this and
> get an "a" inserted into the field:
>
>      get "a"
>      send "keyDown it" to field "field"
>
> So the behavior of a GUI event is not exactly the same as a send with
> a built-in handler at the end of the message path.  Maybe it is like
> a send wrapped in a try/catch where the error is checked for "can't
> find handler" and the default is done then.  It is probably more
> efficient than that.
>
> (Thanks for reminding me.  This might be the solution to a problem I
> have in emulating controls.)
>
>>
>> on rawKeyUp theKey
>>   if theKey is among the items of (65293,65289,65421) or \
>>   theKey is an integer
>>   then
>>     updateCalculation
>>   end if
>> end rawKeyUp
>
> All key codes will match 'is an integer'.  So you are updating for
> every key.
>
> Are you looking for digits?  The key code for a digit is the ASCII
> code for a digit.  So you want to check for the range 48 through 57
> inclusive.
>
> Dar Scott




More information about the Use-livecode mailing list