Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Question on text formatting

From: andy:flyingcat at: 28-Aug-2002 15:18

Thanks for the welcome and the quick responses. Let me post a quick code example, so you can see what I am trying to do (please remember I only started playing with Rebol a couple of weeks ago, so I keep trying to do things the C way, and when that fails, I make it simple/inelegant.... I can't quite manage the same spacing on the leftmost scrolling box (lineup_box) as on the buttons. While I could make the lineup_box a scrolling list of buttons, it seems like too much overhead. (this is where I want to be able to get the maximum size of the larger page that I am scrolling; so I can stop when I've scrolled through all the entries; and if anyone knows of an easy way to force one of the buttons on the scrolling grid to be "selected" my day would be complete :-) ) Thanks, Andy ------------------------------------------------- REBOL [ ] back_color: blue schedule_list: [ "01" "show title" 00:30 "description" "01" "show title 1" 00:30 "description" "01" "show title 2" 01:00 "description" "01" "show title 3" 00:30 "description" "01" "show title 4" 00:30 "description" "01" "show title 5" 00:30 "description" "01" "show title 6" 00:30 "description" "01" "show title 7" 01:00 "description" "01" "show title 8" 00:30 "description" "01" "show title 9" 00:30 "description" "02" "2 show title" 00:30 "description" "02" "2 show title 1" 00:30 "description" "02" "2 show title 2" 00:30 "description" "02" "2 show title 3" 00:30 "description" "02" "2 show title 4" 00:30 "description" "02" "2 show title 5" 00:30 "description" "02" "2 show title 6" 01:30 "description" "02" "2 show title 7" 00:30 "description" "02" "2 show title 8" 00:30 "description" "02" "2 show title 9" 00:30 "description" "03" "2 show title" 00:30 "description" "03" "3 show title 1" 00:30 "description" "03" "3 show title 2" 00:30 "description" "03" "3 show title 3" 00:30 "description" "03" "3 show title 4" 00:30 "description" "03" "3 show title 5" 00:30 "description" "03" "3 show title 6" 00:30 "description" "03" "3 show title 7" 02:30 "description" "03" "3 show title 8" 00:30 "description" "03" "3 show title 9" 00:30 "description" "04" "4 show title" 00:30 "description" "04" "4 show title 1" 00:30 "description" "04" "4 show title 2" 00:30 "description" "04" "4 show title 3" 00:30 "description" "04" "4 show title 4" 00:30 "description" "04" "4 show title 5" 00:30 "description" "04" "4 show title 6" 00:30 "description" "04" "4 show title 7" 00:30 "description" "04" "4 show title 8" 01:30 "description" "04" "4 show title 9" 01:00 "description" "11" "show title" 00:30 "description" "11" "show title 1" 00:30 "description" "11" "show title 2" 00:30 "description" "11" "show title 3" 00:30 "description" "11" "show title 4" 00:30 "description" "11" "show title 5" 00:30 "description" "12" "show title" 00:30 "description" "12" "show title 1" 00:30 "description" "12" "show title 2" 00:30 "description" "12" "show title 3" 00:30 "description" "12" "show title 4" 00:30 "description" "13" "show title" 00:30 "description" "13" "show title 1" 00:30 "description" "13" "show title 2" 00:30 "description" "13" "show title 3" 00:30 "description" "14" "show title 8" 00:30 "description" "14" "show title 9" 00:30 "description" "21" "show title" 00:30 "description" "21" "show title 1" 00:30 "description" "21" "show title 2" 00:30 "description" "21" "show title 7" 00:30 "description" "21" "show title 8" 00:30 "description" "21" "show title 9" 00:30 "description" "22" "show title" 00:30 "description" "22" "show title 1" 00:30 "description" "22" "show title 9" 00:30 "description" "23" "show title" 00:30 "description" "23" "show title 1" 00:30 "description" "23" "show title 2" 00:30 "description" "23" "show title 3" 00:30 "description" "23" "show title 4" 00:30 "description" "24" "show title 3" 00:30 "description" "24" "show title 4" 00:30 "description" "24" "show title 6" 00:30 "description" "24" "show title 7" 00:30 "description" "24" "show title 8" 00:30 "description" "24" "show title 9" 00:30 "description" ] e: func [t][request/ok rejoin ["Program selected is " t "!"]] ee: [e face/text] ; build timeline timeline: layout [ pad 20 backcolor back_color origin 0x0 size 2000x20 at 010x0 text "12:00" at 100x0 text "01:00" at 190x0 text "02:00" at 250x0 text "03:00" at 330x0 text "04:00" at 410x0 text "05:00" at 490x0 text "06:00" at 570x0 text "07:00" at 650x0 text "08:00" at 730x0 text "09:00" at 810x0 text "10:00" at 890x0 text "11:00" at 0970x0 text "12:00" at 1050x0 text "01:00" at 1130x0 text "02:00" at 1210x0 text "03:00" at 1290x0 text "04:00" at 1370x0 text "05:00" at 1450x0 text "06:00" at 1530x0 text "07:00" at 1610x0 text "08:00" at 1690x0 text "09:00" at 1770x0 text "10:00" at 1850x0 text "11:00" ] ; build channel lineup lineup: [ backcolor back_color origin 0x0 space 0x0 pad 0 ] ; build grid page mygrid: [backcolor gray] append mygrid [origin 0x0 ] append mygrid [space 1x1 across ] last-channel: 0 grid_count: 0 grid_v_max: -1 grid_h_max: 0 foreach [channel title time description ] schedule_list [ if (last-channel <> channel) [ append mygrid [ return ] grid_v_max: grid_v_max + 1 if(grid_count > grid_h_max) [ grid_h_max: grid_count] grid_count: 0 append lineup [ text ] append lineup channel ] size: 80x20 if (time >= 1:00) [ size: 160x20 ] if (time >= 1:30) [ size: 240x20 ] if (time >= 1:30) [ size: 320x20 ] append mygrid [ button ] append mygrid size append mygrid copy title append mygrid [ ee ] last-channel: channel grid_count: grid_count + 1 ] grid-f: layout load mygrid grid_h_max: grid_h_max * 2 lineup-f: layout load lineup main: layout [ size 720x400 backcolor back_color across ; guide pad 0 button "cursor-up" [ if(current_grid_count > 0) [ grid-f/offset/2: grid-f/offset/2 + 10 current_grid_count: current_grid_count - 1 grid-f/changes: 'offset lineup-f/offset/2: lineup-f/offset/2 + 10 show grid-small-f show lineup_box] ] button "cursor-down" [ if(current_grid_count < grid_v_max) [ grid-f/offset/2: grid-f/offset/2 - 10 current_grid_count: current_grid_count + 1 grid-f/changes: 'offset lineup-f/offset/2: lineup-f/offset/2 - 10 show grid-small-f show lineup_box ] ] button "cursor-left" [ if(current_h_grid_count > 0) [ current_h_grid_count: current_h_grid_count - 1 grid-f/offset/1: grid-f/offset/1 + 40 grid-f/changes: 'offset timeline/offset/1: timeline/offset/1 + 40 show grid-small-f show time_box ] ] button "cursor-right" [ if(current_h_grid_count < grid_h_max) [ current_h_grid_count: current_h_grid_count + 1 grid-f/changes: 'offset grid-f/offset/1: grid-f/offset/1 - 40 timeline/offset/1: timeline/offset/1 - 40 show grid-small-f show time_box ] ] button "halt" font [colors: [100.100.100]] [ halt ] at 105x90 lineup_box: info 30x196 at 160x50 time_box: info 400x30 back_color at 150x80 panels: box 540x400 ] setpanel: func [ a [object!] ] [ panels/pane: a grid-f/offset: 0x0 current_grid_count: 0 current_h_grid_count: 0 timeline/offset: 0x0 time_box/pane: timeline lineup-f/offset: 0x4 lineup_box/pane: lineup-f show time_box show lineup_box ] print_times: func [ start_time ] [ curr_pos: 10 for curr_time start_time (start_time + 05:00) 00:30 [ reduce [at curr_pos x 10 text curr_time] curr_pos: curr_pos + 80 ] ] panel_grid: layout [ origin 10x8 backcolor back_color below grid-small-f: box 400x200 gray edge [size: 5x5 white] do [ grid-small-f/pane: grid-f grid-f/offset: 0x0 current_grid_count: 0 current_h_grid_count: 0 ] return ] panel_grid/offset: 0x0 setpanel panel_grid view main