Keyboard scroll ??
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Keyboard scroll ??
Sorry, I don't know what to call this subject line.
I frequently deal with loonngg vertically scrolling fields. They are clickable index fields, which navigate to cards in a stack with more than 1000 cards. The fields are alphabetized.
So, I'm often scrolling through these fields, looking for a last name, then a first name, typically. When I do it, I think wistfully of Apple dialog boxes with scrolling fields. Like Open and Save as... dialog boxes. If I type the first letter or two of what I'm looking for, the field scrolls down to the first line that matches the letters I've typed.
I hope I made that clear. If I did...
Is there a reasonable easy way to make RR work this way, on designated cards with long scrolling fields?
Thanks,
Tim
I frequently deal with loonngg vertically scrolling fields. They are clickable index fields, which navigate to cards in a stack with more than 1000 cards. The fields are alphabetized.
So, I'm often scrolling through these fields, looking for a last name, then a first name, typically. When I do it, I think wistfully of Apple dialog boxes with scrolling fields. Like Open and Save as... dialog boxes. If I type the first letter or two of what I'm looking for, the field scrolls down to the first line that matches the letters I've typed.
I hope I made that clear. If I did...
Is there a reasonable easy way to make RR work this way, on designated cards with long scrolling fields?
Thanks,
Tim
-
- Posts: 9
- Joined: Sat Apr 08, 2006 3:54 pm
set the code of fld to this script:
i tested it with exact 1000 lines and it worked very fast.
i hope it is usefull for you
SEIDL.
Code: Select all
on keydown thekey
lock screen
put 0 into i
repeat for each line tline in the text of me
add 1 to i
if char 1 of tline is thekey then
exit repeat
end if
end repeat
put i * the textheight of fld 1
if the textheight of me is empty then set the textheight of me to 14
set the scroll of me to ( i * the textheight of me )
select line i of me
unlock screen
end keydown
i hope it is usefull for you
SEIDL.
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Location: Aalst, Belgium
- Contact:
Hi Tim,
You can write a keyUp handler in your card script, and react to what the user types. Here's something to get you started:
The above script worked for me in Rev 2.7.2, but I had to leave some time between the different letters.
Hope thgis helped,
Jan Schenkel.
You can write a keyUp handler in your card script, and react to what the user types. Here's something to get you started:
Code: Select all
--- script local variable declarations
local sFindString
local sResetMsgID
-- engine message handlers
on keyUp pKey
put pKey after sFindString
-- use 'send in time' costruct to improve performance
if "ScrollToFindString" is not in the pendingMessages
then send "ScrollToFindString" to me in 25 milliseconds
end keyUp
on backspaceKey
delete char -1 of sFindString
-- use 'send in time' costruct to improve performance
if "ScrollToFindString" is not in the pendingMessages
then send "ScrollToFindString" to me in 25 milliseconds
end backspaceKey
-- custom handlers
on ScrollToFindString
put return & sFindString into tFindString
put return & field "Scrolling List Field" into tFieldString
put lineOffset(tFindString, tFieldString) into tLineOffset
set the hilitedLine of field "Scrolling List Field" to tLineOffset
-- give the user some time before resetting the find string
if sResetMsgID is not empty then
cancel sResetMsgID
end if
-- use 'send in time' construct and save the message ID to cancel
send "ResetFindString" to me in 4 seconds
put the result into sResetMsgID
end ScrollToFindString
on ResetFindString
-- clean up local variables
put empty into sFindString
put empty into sResetMsgID
end ResetFindString
Hope thgis helped,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Hi Tim,
Why don't you create a field that, on rawKeyUp, filters a list and puts the result into your list field? That is probably easier than scrolling very long list fields.
-- assume cList is a custom prop
-- containing all data
on rawKeyUp
put the cList of this stack into myList
filter myList with (me & "*")
put myList into fld "Your list field"
end rawKeyUp
Best,
Mark
Why don't you create a field that, on rawKeyUp, filters a list and puts the result into your list field? That is probably easier than scrolling very long list fields.
-- assume cList is a custom prop
-- containing all data
on rawKeyUp
put the cList of this stack into myList
filter myList with (me & "*")
put myList into fld "Your list field"
end rawKeyUp
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode