|
dragoncity
|
Hi, I'm trying to write a data entry form with many fields, this form is longer than a typical monitor viewing area. Creating the form is easy, but I cannot work out how to scroll the whole form 'up/down' when the user TAB's out of the last showing field bottom and display the 'hidden' fields. Rebol actually does TAB to the next field and accepts data entry but you cannot see it without manually moving the scroll slider.
How do I programmatically make the form 'move' up/down ? and sync the slider ? I've tried "all" the example code I can find and none seem to do the trick :-)
In the attached (modified cookbook-scroller.r) program I've added a few fields to illustrate the problem. My need is for rapid data entry and using the mouse is really not a option, The program accepts user data, user TABS to navigate to next field, form slides as necessary, upon last field, data is saved, form cleared, cursor placed at first field, data entry continues.
Thanks for any ideas.
;; =============================== rebol ["cookbook-scroller2.r"] sub-panel: layout [ across origin 5 style label text bold right 60 backcolor tan h2 leaf "Scrolling Sub Panel" return label "Name:" f1: field return label "Email:" f2: field return label "Info:" f3: area wrap return label "Month:" l1: text-list data system/locale/months return label "Day:" s1: slider 200x20 return label button "Submit" button "Cancel" [quit] ]
out: layout [ across h3 "Panel Scrolling Example" return space 0 p1: box 300x300 coal frame black s1: scroller 16x300 [scroll-panel-vert p1 s1] return s2: scroller 300x16 [scroll-panel-horz p1 s2] return ]
p1/pane: sub-panel
scroll-panel-vert: func [pnl bar][ pnl/pane/offset/y: negate bar/data * (max 0 pnl/pane/size/y - pnl/size/y) show pnl ]
scroll-panel-horz: func [pnl bar][ pnl/pane/offset/x: negate bar/data * (max 0 pnl/pane/size/x - pnl/size/x) show pnl ]
update-panel: func [pnl vbar hbar] [ pnl/pane/offset: 0x0 s1/data: s2/data: 0 vbar/redrag pnl/size/y / pnl/pane/size/y hbar/redrag pnl/size/x / pnl/pane/size/x show [pnl vbar hbar] ]
update-panel p1 s1 s2 view out ;; ============
|