Pag Up and Pag Down

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Pag Up and Pag Down

Post by MaxV » Sat May 06, 2017 4:32 pm

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?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Pag Up and Pag Down

Post by FourthWorld » Sat May 06, 2017 4:54 pm

If the field has focus and the vScrollbar of the field is true, the Page keys should work automatically.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Pag Up and Pag Down

Post by dunbarx » Sun May 07, 2017 3:09 am

Failing that, I suppose you could trap the rawKeyWhatever message and scroll the appropriate amount in the appropriate direction.

Craig

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Pag Up and Pag Down

Post by MaxV » Sun May 07, 2017 5:01 pm

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?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Pag Up and Pag Down

Post by jacque » Sun May 07, 2017 5:32 pm

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
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply