World: r3wp
[View] discuss view related issues
older newer | first last |
BrettH 16-Aug-2008 [7934] | I had another look at the scroller problem, and I'm beginning to see that it really does not work ! eg: == the scroll bar does not 'follow' the offset in the pane even when its new position is calculated and set == does not seem to be anyway to adjust the size of the moving bar itself. Unable to find any documentation. == even with calculating the length of the (sliding) form against its (viewable) panel length, the offset 'action' for TAB is not consistent in that the last form field is not always viewable by the tab action -- seems to be dependent upon the relationship between form length and panel size which you can adjust manually but thats hardly a useful solution. When you add a field the whole scroller stops working. ( Flaky !) == pretty disapointing really. Whats needed is a scroller that can be defined to operate with any pane and automatically following the field tabbing in that pane without coding required. "Follow the source --Luke!" Heres the latest code effort ! ;;====================================================== rebol ["cookbook-scroller-2-11.r" author "Brett Hallett 2008 " comment { Modified cookbook-scroller.r program to code automatic scrolling of fields on TAB, allows the form to have fields off the viewable page and automatically scroll up/down as the user leaves a field using TAB. -- display field position on TAB -- eg: print [ "f1 " f1/offset] ( for testing only !) -- scroll-panel-vert func modified with extra parameter ( fields y offset ) -- compute offset value before calling scroll-panel-vert in out: layout -- move trace to func print-pos for easier modification } ] sub-panel: layout [ size 300x350 across origin 0 style label text bold right 60 backcolor green h2 leaf "Scrolling Sub Panel" return label "Name:" f1: field [ print-pos "f1 " f1/offset scroll-panel-vert p1 s1 f1/offset/y ] return label "Email:" f2: field [ print-pos "f2 " f2/offset scroll-panel-vert p1 s1 f2/offset/y ] return label "Info:" f3: area 199x115 wrap [ print-pos "f3 " f3/offset scroll-panel-vert p1 s1 f3/offset/y ] return label "More info: " f4: field [ print-pos "f4 " f4/offset scroll-panel-vert p1 s1 f4/offset/y ] return ;; label "More info: " f41: field [ print-pos "f41 " f41/offset scroll-panel-vert p1 s1 f41/offset/y ] return ;;label "More info: " f42: field [ print-pos "f42 " f42/offset scroll-panel-vert p1 s1 f42/offset/y ] return label "Last ;" f5: field [ print-pos "f5 " f5/offset scroll-panel-vert p1 s1 0 print "write collected data" clear-fields sub-panel ] return ;; notice how the offset of zero is used to set the scroll position to top of form on last field exit below pad 5 below ] btn-panel: layout [ across button "Submit" [ print "Press Submit "] button "Cancel" [ print "Quit" quit] ] main-form: layout [ across h3 "Panel Scrolling Example" return space 0 p1: box 300x250 coal frame black s1: scroller 16x250 [scroll-panel-vert p1 s1 ( s1/data * (max 0 p1/pane/size/y - p1/size/y)) ] ;; compute offset value before calling scroll-panel-vert return p2: box 300x50 ] print-pos: func [ fld pos ] [ print ["print-pos: " fld pos]] ;; scroll-panel-vert modified with extra parameter : fldoffset ( the y offset of the TAB'ded out of field ) scroll-panel-vert: func [pnl bar fldoffset][ ;; print [ "slider:" ( (max 0 p1/pane/size/y - pnl/size/y))] if fldoffset < ( (max 0 p1/pane/size/y - pnl/size/y)) [ pnl/pane/offset/y: negate fldoffset ] ;; print ["pnl-vert " pnl/pane/offset/y fldoffset] show pnl ] update-panel: func [pnl vbar pnl2] [ pnl/pane/offset: 0x0 s1/data: 0 vbar/redrag pnl/size/y / pnl/pane/size/y pnl2/pane/offset: 0x0 show [pnl vbar pnl2] ] p1/pane: sub-panel p2/pane: btn-panel update-panel p1 s1 p2 view main-form ;; ========================== |
Anton 18-Aug-2008 [7935x2] | Hi guys. amacleod, I see the scroll-panel problem, will look into it shortly. |
amacleod, the "selected text prevents scrolling in scroll-panel" problem is not the fault of scroll-panel. demo-scroll-panel.r shows this problem because I didn't want to make it too complex, by including the necessary global event handler to handle scroll events on non-focused scrolling faces (such as scroll-panels). I do have a demo somewhere which has the necessary global event handler somewhere... at least style-gallery.r uses it. | |
amacleod 18-Aug-2008 [7937] | Thanks Anton. |
Anton 18-Aug-2008 [7938] | Are you developing specifically for Windows ? (I just found a bug in scroll-wheel-handler.r on linux.) |
amacleod 18-Aug-2008 [7939x2] | Just checked Style-Gallery.r. Yes, it scrols when high-lighted |
For now!. Windows will surfice. | |
Anton 18-Aug-2008 [7941] | Ok, very good. :) I thought I might try to analyse the Cyphre's tree + Anton's scroll-panel problem you spoke of before. Did you just happen to make a minimal demo showing the problem ? |
amacleod 18-Aug-2008 [7942x2] | I got tree wiget to work but I had to include cypher's scroll panel as well. The problem with his slders not rendering I just realized was probably due to my not including his other stlyes he uses to raw the arrows etc. Unless you mean to get tree widget to use your style it was just a nameing problem if i remembr correctly. I went with a different solution and I am no longer using tree widget for he app. |
raw=draw | |
Anton 18-Aug-2008 [7944] | Ok, you've found another solution for now, but it's still interesting to me if there is a problem mixing styles from different authors. This 'should' (ought to) be possible without any conflict. |
amacleod 18-Aug-2008 [7945] | Anton, I'm looking at Style-Gallery... Should I include "focus-on-down-event-handler.r" in my app? And what about "scroll-wheel-handler.r" Does this add functionality? |
Anton 18-Aug-2008 [7946x5] | Yes and yes. They both bring benefits. Both are global handlers. |
In style-gallery.r, if you go to Global Options / Handlers, you can enable / disable each of the global event handlers (by pressing a toggle button) to see the effect on the user interface dynamically. | |
I've just uploaded gui/demo-scroll-wheel-handler.r and gui/scroll-wheel-handler.r is still there of course. | |
demo-scroll-wheel-handler.r shows how to - get and initialise the scroll-wheel-handler - create and open your windows - wait for events (VIEW does this) - clean up the scroll-wheel-handler | |
do http://anton.wildit.net.au/rebol/gui/demo-scroll-wheel-handler.r | |
Henrik 18-Aug-2008 [7951x4] | Anton, link to http://anton.wildit.net.au/rebol/gui/demo-scroll-area.r is dead |
I'm playing around with scroll-area. SET-FACE/NO-SHOW behaves like SET-FACE. | |
also no action block is available to run, as far as I can see. | |
is it possible to turn off the horizontal scroller? | |
Anton 18-Aug-2008 [7955] | Uploaded demo-scroll-area.r. |
Henrik 18-Aug-2008 [7956] | thanks |
Anton 18-Aug-2008 [7957x2] | Let me check out horizontal scroller ... |
I haven't programmed scrollers to be easily optional (though it's on to-do list). | |
Henrik 18-Aug-2008 [7959] | ok. would it be possible to turn on wrap? for the area, so the scroller might ignore horizontal movement? |
Anton 18-Aug-2008 [7960] | Have you tried setting wrap? already ? |
Henrik 18-Aug-2008 [7961] | I didn't yet study which face directly to set. I assume the text area is inside a pane? |
Anton 18-Aug-2008 [7962x4] | Yes. (This is in scroll-area.r script header, at the top of the Notes..) |
my-scroll-area/pane/1 or my-scroll-area/area/para/wrap?: true | |
Hmm.. it works, but there is an unwanted few pixels scroll when typing first line is wrapped. | |
Let me look why... | |
Henrik 18-Aug-2008 [7966] | could it be made so that the hscroller is simply turned off for area/para/wrap? = true? |
Anton 18-Aug-2008 [7967] | Hmm.. I just tried my-scroll-area/hscroll/show?: false, but as soon as you type, it is shown again... :) |
Henrik 18-Aug-2008 [7968] | it works nicely with BrianH's resizing system, BTW. |
Anton 18-Aug-2008 [7969x2] | Good to hear. |
I'm fixing the show code to respect face/show? for subfaces. | |
Henrik 18-Aug-2008 [7971] | the blank area in the bottom right shows a default gray color. the color there should probably be none to respect the background. |
Anton 18-Aug-2008 [7972x2] | Easy to change. (my-scroll-area/color: none) |
I'll add it to todo... if it's not there already. There might be compositing errors visible when resizing or something... can't remember. | |
Henrik 18-Aug-2008 [7974] | ok, thanks. |
Anton 18-Aug-2008 [7975x5] | I'm going to resize the area to take advantage of space when any of the scrollers has show?: false |
Bit complex... cogitation.... | |
Updated scroll-area | |
load-thru/update http://anton.wildit.net.au/rebol/gui/scroll-area.r do-thru/update http://anton.wildit.net.au/rebol/gui/demo-scroll-area.r | |
- scroll-area/color is now NONE by default to respect background. - The horizontal/vertical scrollers are now optionally and dynamically visible/invisible. - New facets VSCROLL? and HSCROLL? have been added to facilitate this. - When any scroller is not shown, the area resizes to take the extra space. | |
xavier 18-Aug-2008 [7980x2] | anton i got a problem, it says user-prefs has no value |
what is exactly user-prefs | |
Anton 18-Aug-2008 [7982] | hang on... |
xavier 18-Aug-2008 [7983] | its in the demo |
older newer | first last |