Page 1 of 1

Pag Up and Pag Down

Posted: Sat May 06, 2017 4:32 pm
by MaxV
Hi,
how can I send the key press of Pag Up and Pag Down to a field?
I wrote in a card:

Code: Select all

on rawkeydown tvar
   if tVar is 65365 or tvar is 65366 then
      send ("rawkeydown " & tvar) to field 2
   else
      pass rawkeyDown
   end if
end rawkeydown 
but this create an infinite loop!
Any idea?

Re: Pag Up and Pag Down

Posted: Sat May 06, 2017 4:54 pm
by FourthWorld
If the field has focus and the vScrollbar of the field is true, the Page keys should work automatically.

Re: Pag Up and Pag Down

Posted: Sun May 07, 2017 3:09 am
by dunbarx
Failing that, I suppose you could trap the rawKeyWhatever message and scroll the appropriate amount in the appropriate direction.

Craig

Re: Pag Up and Pag Down

Posted: Sun May 07, 2017 5:01 pm
by MaxV
However I can't understand why focusing on the card the code create an infinite loop...
The card send the PagUp to the field, why the field send back the pagup to the card?

Re: Pag Up and Pag Down

Posted: Sun May 07, 2017 5:32 pm
by jacque
If the field does not have a rawKeyDown handler the message passes through until it finds one.

Don't use "send". Either do the action within the rawKeyDown handler, or have rawKeyDown call a different handler to manage the paging.

The message path is critical to how LC works. You can read about it in these tutorials :

http://hyperactivesw.com/revscriptconf/ ... ences.html