"tabs" in VID
[1/2] from: chalz::earthlink::net at: 9-Apr-2006 6:28
Howdy. I've been toying with REBOL for a while, but just now getting into the graphical components. I'm having trouble making TABS work properly. For instance: view layout [across tabs 20 txt "first tab" return tab txt "second tab" return tab tab txt "third tab" return txt "fourth tab" ] This works as expected - "first tab" is on the left, "second tab" is on the next line and indented some, "third tab" is on the next line and indented some more, "fourth tab" is on the next line and on the left again. However: view layout [across tabs [20 75 100] txt "first tab" return tab txt "second tab" return tab tab txt "third tab" return txt "fourth tab" ] When I run that, everything is aligned on the left. When I do this: view layout [across tabs [100 275 500] txt "first tab" return tab txt "second tab" return tab tab txt "third tab" return txt "fourth tab" ] first tab and "fourth tab" are on the left, and "second tab" and "third tab" are indented *some*, but they're both indented equally - "third tab" is indented no more than "second tab". How can I get behavior like using "tabs 20" but with tabs at 20, 50 and 75 instead? Ah, and I'm running REBOL/View 126.96.36.199.1 5-Dec-2005 Core 2.6.3 Thanks. --Charles
[2/2] from: anton::wilddsl::net::au at: 10-Apr-2006 2:26
You have discovered the behaviour of LAYOUT which uses the NEXT-TAB function: ;system/view/vid/next-tab: func [tabs way where][ if pair? tabs [ tabs: max 1x1 tabs return where / tabs * tabs + tabs * way + (where * reverse way) ] if block? tabs [ foreach t tabs [ if integer? t [t: t * 1x1] if all [pair? t (way * t) = (way * max t where)] [ return way * t + (where * reverse way) ] ] ] 100 * way + where ] You can see the difference in behaviour between the two modes. If you supply a pair, it always rounds up to the next tab even if it is now on a tab (it uses division on a pair! to get integer division), but if you supply a block of tabs then it does not round up if it is already now on a tab. This prevents the possibility of multiple tabs in block mode. The solution is to change the test to ensure it rounds up by adding 1x1: (way * t) = (way * max t where + 1x1) After doing this, your examples seem to behave much better ! :-) I will submit this patch to the RAMBO bug database. Regards, Anton.