Auto-scroll problem
Klaus Major
k_major at os.surf2000.de
Wed Aug 7 06:14:01 EDT 2002
Bonjour Yves,
> Hi,
>
> I have a cd with 3 flds
>
> One of those flds is a scrolling list field
> The text in the fld is a list sorted alphabetically
>
> I'd like that when the user press a keybord key, the fld scroll so that
> the first words in the fld begin with this letter
>
> I know I can do that with an empty fld above the scrolling and use the
> filter command (as we see in the transcript dictionnary)
> But I ask myself if it can directly without an added fld.
>
> Thanks.
> -- Greetings.
>
> Yves COPPE
put this in the card-script:
## fld 1 is the list-field.
on keyUp lekey
if lekey is "a" then
## or whatever is your first letter
set the scroll of fld 1 to 0
exit keyup
## will scroll to top
end if
put lineOffset(CR & lekey, field 1) into lo
set the scroll of field 1 to lo * the effective textHeight of field 1
if lo is 0 then
beep
## or whatever...
end if
end keyUp
Tested and works.
You can enhance it by adding some automatic hiliting or
send "mouseup" etc...
Have a nice day.
Klaus Major
k_major at os.surf2000.de
More information about the use-livecode
mailing list