[TIPS] Mouse-wheel field scrolling

FlexibleLearning admin at FlexibleLearning.com
Sun Jun 17 03:37:53 EDT 2012


Sometimes the tips posted here may be a bit intimidating to folks who are
new to LiveCode, so here is a Back-to-Basics one.

A simple stack or card script handler to help smooth field scrolling with
the mouse-wheel...

----------------------------
--| If you already have a rawkeyDown handler in a field, make sure the last
--| line is "pass rawkeyDown" so it is activated higher up the message path
--| in your card or stack script.

on rawkeyDown tKey
  constant numOfLines=5 --| Increase/decrease this number as required
  if "field" is word 1 of the target then
    put (the effective textHeight of the target)*numOfLines into tInc
    if tKey=65309 then
        set the scroll of (the target to the scroll of the target) - tInc
    else if tKey=65308 then
        set the scroll of (the target to the scroll of the target) + tInc
    else pass rawkeydown
  end if
end rawkeyDown
----------------------------

To keep track of all your script goodies, try The Scripter's Scrapbook to
build up your own useful coding reminders, tips, tricks and references. You
can get a 30-day free copy here...

www.ssbk.co.uk


Hugh Senior
FLCo





More information about the use-livecode mailing list