AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 64 |
r3wp | 1992 |
total: | 2056 |
results window for this page: [start: 501 end: 600]
world-name: r3wp
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
Henrik: 1-Feb-2008 | Some notes for your blog post: 'effects' are now 'options' - the idea is here to remove the need for face hacking. Options is a clean, self documentable way to alter the settings for a specific style. But here, the fact that we can alter the appearance of the style is a bit of a fluke, because we wanted a simple way to test options. Originally it was the idea that altering any such effects parameters directly in your layout would be prohibited; The style would take care of this internally and you'd use specific button types that would then use a specific style. You would use buttons defined through its purpose rather than its appearance. You'd have zero control over the appearance of the button, because that is controlled by the style alone. I know that sounds a little terrifying, but VID3 is meant to lift styling to a whole different level; You don't style every single face. You focus on the contents of your UI, and the purpose of each element, rather than its appearance and VID3 works out how to display it. This is for multiple reasons: - VID3 can display on other devices than bitmapped displays, such as text consoles or vectored output. - Styling becomes the job of one or more dedicated developers rather than the application developer, which standardizes styling. It makes it much simpler to build very large applications and it becomes possible to switch consistently between different styles, where one won't look crappy while another one looks great. They'll work equally well. Compare it to VID which is just the Wild West of styling. :-) - Abstraction will make it possible to identify parts of a user interface, such as allowing VID3 to, on its own, find the cancel button in a window or automatically put key focus on the correct button for great consistency. So when you, in your user interface design say: "I want a button that shows importance", you don't try to make a red button. You could use the 'warning-button style (just an example, doesn't exist yet). Similarly there will be styles for ok-button, cancel-button, etc. They are not called red-button, yellow-button, but are purely purpose oriented styles. So while VID3 may look like just a prettier VID with resizing in a one-button example, it's actually a whole different beast. :-) | |
SteveT: 2-Feb-2008 | Thanks Henrik, so VID 3 will expect us to prepare our components or have some already prepared that we can then use - a bit like creating a'skin'. This is much better than 'hacking' each button or box in the middle of your layout. Eg, On my main menu example I could have my 'reflected image button' already pre-defined in my stylize section? Would you like me to post your clarification on my blog? | |
DavidR: 16-Nov-2008 | here is some code I have been working on (commented) but the start button is busted I want it to call the area box with the discalimer details & 2No further buttons, one to quit "Disagree" which is a quit command & "Agree" I want to CLS the page & start a fresh copy of the XP simulated window, the start button would then open a different menu here is the code (its not very elegant I'm afraid): rebol [Title: "SOS-XP"] view layout [ ;makes a gui window 768x576 with a simulated desktop (xP blue) with ibevelled border. image center %DT.jpg 768x576 ibevel pewter 6x6 ;creates an area text box color red with disclaimer message & 2No buttons "agree" & "disagree" ; which hopefully will be situated in the XP destop when the start button is clicked. disclaim: [at 200x300 area wrap font-color white {You use this program & batch files entirely at your own risk, due to the myriad of hardware/software configurations I cannot without any certainty claim that you will not damage your system! Always Always Always make a full system backup of your partition before attempting to use SOS-XP & that you have tested the back up so your are positive in your own mind you can make a recovery!} red bold at 240x410 button "Agree" at 450x410 button "Disagree"] ; this is the simulated XP start button button gray 50x30 "START" [disclaim] ; this is a small vertical button to make the xP start button look more realistic. at 75x605 button gray 3x30 ; this is a digital clock to simulate the destop clock bottom right on screen. at 750x610 text "00:00" rate 1 black ;effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act] [face/text: now/time show face]] ]755x650 rebol [Title: "SOS-XP"] view layout [ ;makes a gui window 768x576 with a simulated desktop (xP blue) with ibevelled border. image center %DT.jpg 768x576 ibevel pewter 6x6 ;creates an area text box color red with disclaimer message & 2No buttons "agree" & "disagree" ; which hopefully will be situated in the XP destop when the start button is clicked. disclaim: [at 200x300 area wrap font-color white {You use this program & batch files entirely at your own risk, due to the myriad of hardware/software configurations I cannot without any certainty claim that you will not damage your system! Always Always Always make a full system backup of your partition before attempting to use SOS-XP & that you have tested the back up so your are positive in your own mind you can make a recovery!} red bold at 240x410 button "Agree" at 450x410 button "Disagree"] ; this is the simulated XP start button button gray 50x30 "START" [disclaim] ; this is a small vertical button to make the xP start button look more realistic. at 75x605 button gray 3x30 ; this is a digital clock to simulate the destop clock bottom right on screen. at 750x610 text "00:00" rate 1 black ;effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act] [face/text: now/time show face]] ]755x650 rebol [Title: "SOS-XP"] view layout [ ;makes a gui window 768x576 with a simulated desktop (xP blue) with ibevelled border. image center %DT.jpg 768x576 ibevel pewter 6x6 ;creates an area text box color red with disclaimer message & 2No buttons "agree" & "disagree" ; which hopefully will be situated in the XP destop when the start button is clicked. disclaim: [at 200x300 area wrap font-color white {You use this program & batch files entirely at your own risk, due to the myriad of hardware/software configurations I cannot without any certainty claim that you will not damage your system! Always Always Always make a full system backup of your partition before attempting to use SOS-XP & that you have tested the back up so your are positive in your own mind you can make a recovery!} red bold at 240x410 button "Agree" at 450x410 button "Disagree"] ; this is the simulated XP start button button gray 50x30 "START" [disclaim] ; this is a small vertical button to make the xP start button look more realistic. at 75x605 button gray 3x30 ; this is a digital clock to simulate the destop clock bottom right on screen. at 750x610 text "00:00" rate 1 black ;effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act] [face/text: now/time show face]] ]755x650 | |
Henrik: 16-Nov-2008 | ok, showing and hiding faces are done with SHOW and HIDE. Example: view layout [button "Start" [either a/show? [hide a][show a]] a: area] | |
Sunanda: 16-Nov-2008 | Henrik is just ahead of me --- you have disclaim as block. Also, maybe when getting started, dont worry about the absolute positionings (they'd need to be adjusted according to screen resolution anyway). This simplification of your code works for me: (note the unview/all to remove any previous instances): rebol [Title: "SOS-XP"] unview/all view layout [ across disclaim: area wrap font-color white {You use this program & batch files entirely at your own risk, due to the myriad of hardware/software configurations I cannot without any certainty claim that you will not damage your system! Always Always Always make a full system backup of your partition before attempting to use SOS-XP & that you have tested the back up so your are positive in your own mind you can make a recovery!} red bold return button "Agree" return button "Disagree"] return button gray 50x30 "START" [disclaim] ; this is a small vertical button to make the xP start button look more realistic. return button gray 3x30 ; this is a digital clock to simulate the destop clock bottom right on screen. return text "00:00" rate 1 black ;effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act] [face/text: now/time show face] ] | |
Sunanda: 16-Nov-2008 | Copying is sometimes the best way. There are some stray ]s in the code I just posted.....Sorry. This below really does work: rebol [Title: "SOS-XP"] unview/all view layout [ across disclaim: area wrap font-color white {You use this program & batch files entirely at your own risk, due to the myriad of hardware/software configurations I cannot without any certainty claim that you will not damage your system! Always Always Always make a full system backup of your partition before attempting to use SOS-XP & that you have tested the back up so your are positive in your own mind you can make a recovery!} red bold return button "Agree" return button "Disagree" return button gray 50x30 "START" [disclaim] ; this is a small vertical button to make the xP start button look more realistic. return button gray 3x30 ; this is a digital clock to simulate the destop clock bottom right on screen. return text "00:00" rate 1 black ;effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act] [face/text: now/time show face]] ] | |
Gregg: 16-Nov-2008 | Carl even did a layout editor...must be somewhere. | |
Gregg: 16-Nov-2008 | http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=layout-1.8.r | |
DavidR: 18-Nov-2008 | what is the difference between main layout & view layout | |
Gregg: 18-Nov-2008 | Not sure what you mean. You can create a layout without viewing it, and use view/new to open more than one window. If you just do VIEW LAYOUT [...], that starts the event loop, and you'll want to use view/new to show other layouts. | |
Henrik: 18-Nov-2008 | LAYOUT produces a tree of objects. Each object is a face. VIEW displays that tree of objects. | |
Anton: 18-Nov-2008 | Yeah, you can call it whatever you want (avoiding other default rebol global words, of course). I usually call the one window in my one-window apps WINDOW. eg. window: layout [...] view window which, in simple cases, can be compressed to: view window: layout [...] | |
Sunanda: 19-Nov-2008 | Hope I am not adding extra confusion by adding this attempted explanation... ** Many applications will have a single VIEW LAYOUT [...] to display everything. ** They can then use SHOW and HIDE to selectively make displayed faces visible or not. ** If you have several sets of controls that need to replace each other (like when you click a tab) then subpanels within the one VIEW is the way to go: ** You have a separate LAYOUT for each subpanel. (You probably got the idea that the main view is called MAIN from Carl's subpanel examples. It can be called anything). ** To SHOW a subpanel, you set the panel contents to the appropriate LAYOUT. ** Finally, as Gregg says, you can have multiple, independent windows using VIEW/NEW. Best to work up to that slowly :-) | |
DavidR: 25-Nov-2008 | rebol [Title: "SOS-XP"] view layout [ image center %DT.jpg 768x576 ibevel pewter 6x6 button gray 50x30 "START" [show panel1] at 75x605 button gray 3x30 at 750x610 text "00:00" rate 1 black ;effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act] [face/text: now/time show face]] ] panel1: view layout [ image center %DT.jpg 768x576 ibevel pewter 6x6 at 75x605 button gray 3x30 at 750x610 text "00:00" rate 1 black ;effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act] [face/text: now/time show face]] at 200x300 area wrap font-color white {You use this program & batch files entirely at your own risk, due to the myriad of hardware/software configurations I cannot without any certainty claim that you will not damage your system! Always Always Always make a full system backup of your partition before attempting to use SOS-XP & that you have tested the back up so your are positive in your own mind you can make a recovery!} red bold at 240x410 button "Agree" [show panel2] at 450x410 button "Disagree" [QUIT]] do-events panel2: view layout [ image center %DT.jpg 768x576 ibevel pewter 6x6 button gray 50x30 "START" [show panel3] at 75x605 button gray 3x30 at 750x610 text "00:00" rate 1 black ;effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act] [face/text: now/time show face]] ]755x650 | |
Graham: 25-Nov-2008 | the panels need to be defined earlier panel2: layout [ ... ] | |
btiffin: 25-Nov-2008 | I think panel3: layout [ ...] panel2: layout [ ...] pane1: layout [ ...] then the main view layout would work Graham beat me to it. | |
DavidR: 25-Nov-2008 | so according to btiffin I am working back to front (panel3 then panel2 then panel1 then the main layout) | |
Graham: 25-Nov-2008 | panel1 ... 3 are objects, which are returned by layout | |
Graham: 25-Nov-2008 | panel1: view layout [ ] is not defining the layout | |
btiffin: 25-Nov-2008 | Yeah DavidR; the order doesn't really matter as long as the definitions come before REBOL has to reduce the value. REBOL will let you make and load values (simply word! at that stage), but these words have to have a value when evaluation (reduce, do, ... or show in this case) is required. Next... Then change the show panel1 to view panel1 after panel1: layout [ ... ] is used to create the face object. | |
DavidR: 25-Nov-2008 | Tell ya what without all the code clonk inbetween & as a structure can you provide a simple layout. Yes tried view /new for opening another window with the previous set behind I think it will go up to 8 windows deep? | |
Anton: 25-Nov-2008 | Graham, panel1: view layout [ ] *is* defining the layout. It's also opening it as a window and waiting for events, of course. Remember VIEW just returns the face that it was given. | |
Anton: 25-Nov-2008 | rebol [Title: "SOS-XP"] view layout [ button "START" [show panel1] ] panel1: view layout [ area {You use this program & batch files entirely at your own risk} button "Agree" [show panel2] button "Disagree" [quit] ] do-events panel2: view layout [ button "START" [show panel3] ] | |
Anton: 25-Nov-2008 | Here are some ways to use VIEW and DO-EVENTS. 1) view window 2) view/new window1 view/new window2 do-events 3) window: layout [ button "open child window" [ window2: layout [text "child window"] view/new window2 ] ] view window | |
Anton: 25-Nov-2008 | if not exists? %SOS-XP-user-agreed [ ; File does not exist yet ? view layout [ text "You use this software entirely at your own risk." button "I Agree" [ write %SOS-XP-user-agreed "" ; Create file. unview ] button "I Disagree" [ print "I Disagree" ;quit unview halt ] ] ] view center-face layout [ h1 "Main application window" ] | |
Sunanda: 26-Nov-2008 | unview/all main: layout [ banner "main" button "START" [unview/only main view panel1] ] panel1: l ayout [ banner "panel1" area {You use this program & batch files entirely at your own risk} button "Agree" [unview/only panel1 view panel2] button "Disagree" [quit] ] panel2: layout [ banner "panel2" button "START" [view panel3] ] view main | |
Sunanda: 26-Nov-2008 | Oops -- typo in that code: bad::: panel1: l ayout good: panel1: layout | |
Sunanda: 27-Nov-2008 | If you can get it to work as separate windows, you have all your logic flow in place. It's then comparatively trivial to: ** add a panel to the main layout ** change the "unview ... view" lines into show/hides for the panels. In fact, with very few lines of code, you could have it working either way according to a user preference.....I have one application that does that: the main panels are eiher in one window, or float free as separate ones. But focus on getting it working first! | |
Henrik: 17-Apr-2009 | An example where DO wouldn't work would be VID (the graphics user interface system, Visual Interface Dialect) do [button "Hello world!"] ; gives an error layout [button "Hello world!"] ; returns a meaningful result, because the block was parsed as a dialect. | |
mhinson: 21-Apr-2009 | That is very good and usefull thanks. Is there any way to get help on things like view layout [ slider ] please. I am paticularly keen to find how the data is returned from these controls. something like view layout [ h2 slider ] but that dosn't work.. there are hundreds of examples of how pretty the vid functions are, but I have failed to find much about using the results returned. | |
Geomol: 21-Apr-2009 | view layout [h: h2 "data shows here" slider [h/text: value show h]] | |
Geomol: 21-Apr-2009 | The name of the variable holding the data for slider is called value. You have to look at docs to figure that out: http://www.rebol.com/docs/easy-vid.html Or you can look into the styles yourself, like: >> layout [s: slider] >> ? s | |
Geomol: 21-Apr-2009 | Well, it might confuse to talk about do-face. :-) When you create a face (style) with an action block, it's set in the face. You can see it like this: >> layout [s: slider [print "hm"]] >> probe get in s 'action func [face value][print "hm"] That function is called, when you operate the style (face). Makes sense? | |
Henrik: 21-Apr-2009 | LAYOUT is the VID dialect, which is REBOL's layout engine. When giving it a block of words, it produces a tree of objects, that each are a face. Each face contains sizes, offsets, colors, texts, event handlers and actions to perform when clicking on the face. | |
Henrik: 21-Apr-2009 | whoa, Anton is showing expert stuff there. it really should not be necessary to work with faces at that level. try settling for VIEW, LAYOUT, SET-FACE and GET-FACE for now. The next level would be events and the FEEL object. Then possibly STYLIZE. | |
Henrik: 21-Apr-2009 | getting a value from a face is easy-peasy: view layout [field [name: get-face face print name]] | |
mhinson: 21-Apr-2009 | I have just realised that in your line of code "field" is the name of one of the VID functions, so I understand that one now, thanks. If I use view layout [button "Ok" [name: get-face face print name]] it just returns "none", not down or up or true or false or clicked etc. I tried this view layout [button "Ok2" [name: value print name]] and it returns the text on the button does this mean get-face does not work on button? could I have predicted this? If I try to reference a different value like this view layout [button "Ok2" [name: value/text print name]] I just get an error & I have to restart the console to close the button. is this where I should be able to interpret print mold system/view/vid/vid-styles/button/feel to know how to ask for the parts of the value? Thanks very much for all the help. I am back at work now so can mostly only study this in the evenings. | |
Anton: 22-Apr-2009 | A FIELD is a style, just like BUTTON, AREA etc. See the full list of available built-in styles like this: print mold extract svv/vid-styles 2 Check the ACCESS facet of a style to see what GET-FACE returns. For BUTTON, it is: >> print mold svv/vid-styles/button/access make object! [ set-face*: func [face value][face/data: value] get-face*: func [face][face/data] clear-face*: func [face][face/data: false] reset-face*: func [face][face/data: false] ] You can see that using GET-FACE on a BUTTON just returns face/data. Buttons by default don't use their data facet for anything, so it's NONE. (You could use the data facet to relate a button to something else that the button is associated with.) Here's an example where a button does GET-FACE on a field. view layout [button "get-face field" [probe get-face my-field] my-field: field "hello"] | |
Henrik: 22-Apr-2009 | mhinson, you've stumbled onto the first limitation. If we take the line of code apart, it does the following: view ; view the created layout layout ; create the layout (object tree of FACES) from the VID dialect block [ ; start of VID dialect block button ; the first element, a BUTTON "ok" ; the text for BUTTON [ ; start of the action block for the button. it's evaluated when the button is clicked. name: get-face face ; get the value of the button through the buttons GET-FACE accessor print name ; print the value (likely none) ] ; end of action block ] ; end of layout block Now when I say limitation, it's because you can't easily check for mouse button up, release, mouse movement, etc. The VID dialect directly uses a block right after the button description to describe what should happen after clicking the button. That's part of the syntax and above I wrote it as: <face style> <face text> [<action>] You can specify size, color, edge size, background image and a few grahpical effects. And with it being a dialect, you can leave things out or swap the ordering of some parameters. If you want more advanced control, you need to use the FEEL object, but you are definitely not ready for that. :-) Settle for working with VID and some layouts like above. VID was designed to be easy and very fast to use. If you go beyond VID, you will need a whole lot more knowledge on how to do things. | |
mhinson: 22-Apr-2009 | Thanks for your help again. Trust me to stumble on something ;-) I think I am getting there now. Would this be the right way to identify which button was pressed? view layout [button "ok" [print "button1"] button "ok" [print "button2"]] I was expecting the buttons to have names other than the text on the button. I guess identifying the button by its possition in the code is what I will need to do. Thanks. I have never done any GUI programming before so perhaps I am just in a muddle about how it is done in general terms. I was expecting the event that a button was pressed to pop up in another part of the code (are they called event handlers?) (thus needing to identify which button it was). If Rebol dosn't do it like that I may just be asking the wrong questions. | |
Henrik: 22-Apr-2009 | I guess identifying the button by its possition in the code is what I will need to do. Not necessary. That is what the set-word! prior to the style name is for. You can do that like this: layout [b: button "Hello!" [print "clicked"]] 'b is now a button face. You can access it like this: >> get-face b == none >> b/text == "Hello!" >> b/color == 44.80.132 >> do-face b none clicked From inside the action block, you can also access it by FACE, e.g.: [get-face face] | |
mhinson: 22-Apr-2009 | AH, this is a bit of a revelation.. Now I know where to find all those values. And I can use this sort of construct view layout [b: button "Hello!" [b/text: "goodbye"]] Thank you thank you thank you very much. | |
mhinson: 22-Apr-2009 | Thanks, I will try to make myself an example to understand that further. I have another small stumbling block here that I would appreciate some wisdom on please.. ; This works view layout [a1: area (to-pair rejoin ["80x" random 100]) button "ok" [print a1/size]] ; but not this view layout [ box effect [ draw [ line 20x20 (to-pair rejoin ["80x" random 100])]] ] Is this because the dialect is different in one place to the other? I was heading towards using a slider to manipulate stuff on the screen, so this is a first step towards that. | |
Henrik: 22-Apr-2009 | I'm not sure, but the draw block should be composed. If you are only calculating the random position once per view, you can COMPOSE/DEEP the layout block or: pos: as-pair 80 random 100 view layout [box effect [draw [line 20x20 pos]]] (untested) | |
Anton: 22-Apr-2009 | view layout [ box effect compose/deep [ draw [ line 20x20 (as-pair 80 random 100) ] ] ] | |
mhinson: 22-Apr-2009 | Well, I modified the code from draw-controls.r in the script library to get this. It is more complex than I expected, Is it a reasonable way to do this sort of thing please? pos1: 20x20 pos2: 80x0 view layout [ scrn: box rate 0:0:0.1 feel [ engage: func [face action event] [ if action = 'time [ scrn/effect/draw: copy [] append scrn/effect/draw [line pos1 pos2] show scrn ] ] ] effect [ draw [] ] s1: slider [ ss1: to-integer (100 * get-face s1) pos2: (as-pair 80 ss1) ] ] Next step is to work out how to make the thing that moves leave a trail. | |
Anton: 22-Apr-2009 | view layout [box: box effect [draw [line 20x20 80x20]] slider [box/effect/draw/3/y: to-integer value * 60 + 20 show box]] | |
Anton: 22-Apr-2009 | view layout [my-image: image (make image! 100x100) slider [draw my-image/image reduce ['line 20x20 as-pair 80 value * 60 + 20] show my-image]] | |
Anton: 23-Apr-2009 | img: make image! 100x100 draw-blk: [line 20x20 80x20] view layout [my-image: image (img) slider [draw-blk/3/y: value * 60 + 20 draw img draw-blk show my-image]] | |
mhinson: 7-May-2009 | Hi, I have been working on a bit of code for some time & it now does something usefull for me, but to use it I am coding the output file into the code & running it repeatedly against every file in a directory. I thought it would be nice for it to have a very simple GUI to navigate to the input directory & output file & perhaps display some indicator of progress. Is this something a beginner might hope to add to existing code, or should I start from scratch again with the GUI part, then try to recreate my code in the view Layout part? Thanks. | |
Henrik: 7-May-2009 | you can create a prototype of the GUI first, by just creating a layout with the placement of the styles you want. afterwards you can make it work as you want using SET-FACE, GET-FACE, etc. | |
Henrik: 7-May-2009 | It's very easy to create prototypes and VID is excellent for that: view layout [ across space 2 box blue 300x300 "List View" box yellow 100x300 "Buttons" return box red 402x24 "OK/Cancel Panel" ] | |
mhinson: 7-May-2009 | if I have view layout [box green 400x400 field] the interpreter wont even load any more lines of script while the box is on the screen, so I am guessing I have to call the rest of my code from within the view layout block? | |
Henrik: 7-May-2009 | Then try this line: view layout [b: box green 400x400 f: field] Go back to console and escape. b/color: yellow show b set-face f "hello" get-face f hide f show f That's how you access UI parts. | |
Gregg: 11-May-2009 | REBOL [] do %include.r include %file-list.r flash-wnd: flash "Finding test files..." if file: request-file/only [ files: read first split-path file ] if none? file [halt] items: collect/only item [ foreach file files [item: reduce [file none]] ] unview/only flash-wnd ;------------------------------------------------------------------------------- ;-- Generic functions call*: func [cmd] [ either find first :call /show [call/show cmd] [call cmd] ] change-each: func [ [throw] "Change each value in the series by applying a function to it" 'word [word!] "Word or block of words to set each time (will be local)" series [series!] "The series to traverse" body [block!] "Block to evaluate. Return value to change current item to." /local do-body ][ do-body: func reduce [[throw] word] body forall series [change/only series do-body series/1] ; The newer FORALL doesn't return the series at the tail like the old one ; did, but it will return the result of the block, which is CHANGE's result, ; so we need to explicitly return the series here. series ] collect: func [ "Collects block evaluations." [throw] 'word block [block!] "Block to evaluate." /into dest [block!] "Where to append results" /only "Insert series results as series" /local fn code marker at-marker? marker* mark replace-marker rules ][ block: copy/deep block dest: any [dest make block! []] fn: func [val] compose [(pick [insert insert/only] not only) tail dest get/any 'val get/any 'val ] code: 'fn marker: to set-word! word at-marker?: does [mark/1 = marker] replace-marker: does [change/part mark code 1] marker*: [mark: set-word! (if at-marker? [replace-marker])] parse block rules: [any [marker* | into rules | skip]] do block head :dest ] edit-file: func [file] [ ;print mold file call* join "notepad.exe " to-local-file file ;join test-file-dir file ] flatten: func [block [any-block!]][ parse block [ any [block: any-block! (change/part block first block 1) :block | skip] ] head block ] logic-to-words: func [block] [ change-each val block [either logic? val [to word! form val] [:val]] ] standardize: func [ "Make sure a block contains standard key-value pairs, using a template block" block [block!] "Block to standardize" template [block!] "Key value template pairs" ][ foreach [key val] template [ if not found? find/skip block key 2 [ repend block [key val] ] ] ] tally: func [ "Counts values in the series; returns a block of [value count] sub-blocks." series [series!] /local result blk ][ result: make block! length? unique series foreach value unique series [repend result [value reduce [value 0]]] foreach value series [ blk: first next find/skip result value 2 blk/2: blk/2 + 1 ] extract next result 2 ] ;------------------------------------------------------------------------------- counts: none refresh: has [i] [ reset-counts i: 0 foreach item items [ i: i + 1 set-status reform ["Testing" mold item/1] item/2: random/only reduce [true false] show main-lst set-face f-prog i / length? items wait .25 ] update-counts set-status mold counts ] reset-counts: does [counts: copy [total 0 passed 0 failed 0]] set-status: func [value] [set-face status form value] update-counts: has [pass-fail] [ counts/total: length? items pass-fail: logic-to-words flatten tally collect res [foreach item items [res: item/2]] ;result (e.g.): [true 2012 false 232] standardize pass-fail [true 0 false 0] counts/passed: pass-fail/true counts/failed: pass-fail/false ] ;--------------------------------------------------------------- main-lst: sld: ; The list and slider faces c-1: ; A face we use for some sizing calculations none ml-cnt: ; Used to track the result list slider value. visible-rows: ; How many result items are visible at one time. 0 lay: layout [ origin 5x5 space 1x0 across style col-hdr text 100 center black mint - 20 text 600 navy bold { This is a sample using file-list and updating progress as files are processed. } return pad 0x10 col-hdr "Result" col-hdr 400 "File" col-hdr 100 return pad -2x0 ; The first block for a LIST specifies the sub-layout of a "row", ; which can be any valid layout, not just a simple "line" of data. ; The SUPPLY block for a list is the code that gets called to display ; data, in this case as the list is scrolled. Here COUNT tells us ; which ~visible~ row data is being requested for. We add that to the ; offset (ML-CNT) set as the slider is moved. INDEX tells us which ; ~face~ in the sub-layout the data is going to. ; COUNT is defined in the list style itself, as a local variable in ; the 'pane function. main-lst: list 607x300 [ across space 1x0 origin 0x0 style cell text 100x20 black mint + 25 center middle c-1: cell cell 400 left cell [edit-file item/1] ] supply [ count: count + ml-cnt item: pick items count face/text: either item [ switch index [ 1 [ face/color: switch item/2 reduce [none [gray] false [red] true [green]] item/2 ] 2 [mold item/1] 3 ["Edit"] ] ] [none] ] sld: scroller 16x298 [ ; use SLIDER for older versions of View if ml-cnt <> (val: to-integer value * subtract length? items visible-rows) [ ml-cnt: val show main-lst ] ] return pad 0x20 f-prog: progress 600x16 return status: text 500 return button 200 "Run" [refresh show lay] pad 200 button "Quit" #"^q" [quit] ] visible-rows: to integer! (main-lst/size/y / c-1/size/y) either visible-rows >= length? items [ sld/step: 0 sld/redrag 1 ][ sld/step: 1 / ((length? items) - visible-rows) sld/redrag (max 1 visible-rows) / length? items ] view lay | |
Group: Linux ... [web-public] group for linux REBOL users | ||
Anton: 30-Aug-2008 | view layout [text-list data ["hello" "bonjour"]] | |
Anton: 18-Mar-2009 | Well, in Rebol/View 2.7.6.4.2, I can paste the multiply sign (copied from ascii-math.r) straight into the console and it shows correctly. In a field, however, it shows incorrectly, eg. if I try to paste it in the field: view layout [f: field] I get two characters, 'Γ' and a dotted box, displayed instead. The binary information is correct, it's just not rendered correctly, for if back in the console I do: probe f/text then I get the multiply symbol displayed correctly again. So it looks like View face/text rendering is expecting 8-bit ascii of some encoding. Probably ISO/IEC_8859-1 | |
Anton: 7-Apr-2009 | I've just opened a little Rebol window without title bar or border, but it can be moved around and handles events as a normal window does (eg. view layout [button area] works). | |
Geomol: 7-Apr-2009 | This window without title bar can be moved in R2: main: layout [origin 0 box "Drag me!" feel [engage: func [f a e] [if a = 'down [pos: e/offset] if find [over away] a [main/offset: main/offset - pos + e/offset show main]]]] view/options main [no-title] | |
Izkata: 9-Apr-2009 | Tested with a simple "view layout [box]" on Ubuntu Hardy with the wmii window manager, View does not crash when using xrandr to change resolution. | |
Anton: 6-May-2009 | I am interested in improving the display of fonts by R2 on Kubuntu Gutsy 7.10. I am not yet aware of what font rendering systems are used by Kubuntu, but I can see lots of True Type Font (.ttf) files anyway. I can get R2 View to display a font (eg. gentium), but the scaling looks pretty bad. eg. view layout [text "Hello" font-name "gentium" font-size 16] | |
MaxV: 2-Sep-2009 | view layout [ box 400x500 effect [draw stats]] | |
Ashley: 22-Oct-2009 | try: help font- view layout [text "test" font-fixed] view layout [text "test" font-sans-serif] view layout [text "test" font-serif] | |
Ashley: 22-Oct-2009 | Try same, but with bold and underline (e.g.view layout [text "test" font-fixed bold underline]) | |
Group: AGG ... to discus new Rebol/View with AGG [web-public] | ||
Cyphre: 18-May-2006 | view layout [ origin 0 bx: box 400x400 black effect [ draw [ translate 0x400 scale 1 -1 pen red line 50x50 350x50 pen blue line 50x50 50x350 pen yellow line 50x50 100x200 200x150 300x250 350x225 ] ] ] | |
Cyphre: 19-May-2006 | translate-draw: func [ height [integer!] blk [block!] /local dr p ][ parse blk [some ['draw set dr block! (parse dr [some [p: pair! (p/1: as-pair p/1/x height - p/1/y) | skip]]) | skip]] blk ] view layout [ origin 0 bx: box 400x400 black effect translate-draw 400 [ draw [ pen red line 50x50 350x50 pen blue line 50x50 50x350 pen yellow line 50x50 100x200 200x150 300x250 350x225 pen white text aliased 10x350 "Y axis" text aliased 320x40 "X axis" ] ] ] | |
Graham: 5-Jun-2006 | So, why does the text move across the page ? view/new layout [ b: box 400x400 black effect [ draw []] ] for i 0 90 5 [ b/effect: compose/deep [ draw [ rotate (i) text vectorial "This is a string of text 1" 300x75 ]] show b wait .2 ] | |
Geomol: 4-Dec-2006 | Is there a reason, why SPLINE doesn't draw anything with just two points? view layout [box effect [draw [pen black spline 10x10 90x90]]] | |
Oldes: 5-Mar-2007 | this code draws nothing: view layout [ box 400x400 effect [draw [ rotate -90 fill-pen red arc 200x200 90x90 0 108 closed fill-pen green arc 200x200 90x90 108 252 closed ]] ] | |
Oldes: 5-Mar-2007 | never mind, I already used my rebol/flash dialect to make the chart. I just wanted to say, that there is probably a bug, because this is working: view layout [ box 400x400 effect [draw [ rotate 15 fill-pen red arc 200x200 90x90 0 108 closed fill-pen green arc 200x200 90x90 108 252 closed ]] ] | |
Cyphre: 21-May-2007 | To clarify it have a look at result this example: view layout [ box 600x400 effect [ draw [ fill-pen blue box 50x50 150x150 translate 50x50 fill-pen red box 50x50 150x150 reset-matrix translate 70x70 fill-pen yellow box 0x0 100x100 ] draw [ translate 200x0 fill-pen blue box 50x50 150x150 translate 50x50 fill-pen red box 50x50 150x150 translate 70x70 fill-pen yellow box 0x0 100x100 ] ] ] | |
Dockimbel: 21-May-2007 | view layout [ box effect [ draw [ pen black red push [shape [move 0x0 line 50x50]] ] ] ] | |
Geomol: 31-May-2007 | view layout [box 400x400 white effect [draw [pen none fill-pen red shape [move 100x100 arc 300x300 90 false true arc 100x100 90 false true move 150x150 arc 250x250 60 true true arc 150x150 60 true true]]]] When I run this code under OS X, REBOL/View version 2.7.5, I get the effect. I find, that some of the parameters isn't logic. The documentation is ambigious, http://www.rebol.com/docs/draw-ref.html#section-5, so it may change. | |
Geomol: 31-May-2007 | Maybe this give a clue? view layout [b: box 400x400 white effect [draw [shape [move 0x200 arc 90 200x400 false true]]] at 300x20 slider [b/effect/draw/shape/arc: to-integer value * 360 show b]] | |
Henrik: 11-Jun-2007 | ICarii: http://cocoadevcentral.com/images/articles/000086-tigerarc.png <--- is this layout possible? | |
Cyphre: 16-Jun-2007 | ICarii: Cool stuff Henrik: I don't see any problem to render such isometric layout using DRAW. | |
btiffin: 13-Oct-2007 | I was just about to try view layout [b: box effect [draw [text "test"]]] planning to poke around with help b to see, then I remembered that REBOL Linux doesn't have draw text :( Sorry. But that's were I would start....poking around in the objects. May well be a waste of time... Then I'd fire up anamonitor and view through some of the system objects for that key ...size-text... kinda function. If that didn't work I'd give up and wait for Cyphre :) Excuse the babbling... | |
Anton: 9-Oct-2008 | view layout [box effect [draw [pen red line-width 2 shape [line 0x0 10x0 10x10 0x10] pen green shape [line 5x0 10x5 5x15 0x5]]]] | |
amacleod: 9-Oct-2008 | I'm doing something like this: view layout [ b: box effect [draw [pen red fill-pen red line-width 2 shape [line 0x0 40x0 40x40 0x40] ] ] btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen green 'shape ['line 5x0 30x5 5x25 0x20]]show b] ] Its much more complicated as I'm painting highlights on a series of faces in a panel. I go back and highlight in another color where a specified word is found. The hi-lite shows if its on a section of text not yet painted but not if it falls on painted text. The above example works! so it must be some where else in my app... Thanks. I'll look it over... | |
Anton: 9-Oct-2008 | view layout [box effect [draw [pen red line-width 5 line 0x0 100x100]] "hello"] | |
amacleod: 9-Oct-2008 | Actually I don't like this behavior...its too complicated to remove it again.Back to my original plan of moving and resizing a box form face to face... view layout [ bx: box 100.100.255 0x0 b: box effect [draw [pen red fill-pen red line-width 2 shape [line 0x0 40x0 40x40 0x40]]] at 40x40 text "Hello World" btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen green 'shape ['line 5x0 30x5 5x25 0x20]]show b] btn "Moving box" [bx/offset: 20x20 bx/size: 90x90 show bx] ] for example. Now if I draw the box after the face it covers the textt which I want to avoid too.view layout [ bx: box 100.100.255 0x0 b: box effect [draw [pen red fill-pen red line-width 2 shape [line 0x0 40x0 40x40 0x40]]] at 40x40 text "Hello World" btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen green 'shape ['line 5x0 30x5 5x25 0x20]]show b] btn "Moving box" [bx/offset: 20x20 bx/size: 90x90 show bx] | |
Anton: 9-Oct-2008 | ; in its pane view layout [h1 "hello" with [pane: make face [offset: 5x5 size: 20x10 effect: [merge luma 90] edge: none]]] | |
Group: Rebol School ... Rebol School [web-public] | ||
Sunanda: 19-Nov-2008 | Can anyone help answer this question --- received as a Feed back message on REBOL.org. Thanks! ===== Does Rebol support cyrillic? I can't see symbols in my language in this simple program: view layout/size [button "ΠΠ°ΠΆΠΌΠΈ" [alert "ΠΡΠΈΠ²Π΅Ρ!"]] 400x300 How come that Rebol doesn't support UTF-8? Or maybe there is another way to see Russian letters on buttons?.. 3 days of googling...nothing... example: view layout/size [button "ΠΠ°ΠΆΠΌΠΈ" [alert "ΠΡΠΈΠ²Π΅Ρ!"]] 400x300 ===== | |
Sunanda: 19-Nov-2008 | Thanks Petr. He may have to wait for a supported UNICODE-enabled release. Having given it a few moments thought, he may be able to fake it in *some* controls with font-name: view layout [box "hello" font-name "xxx"] ;; where xxx is the name of an installed font on his machine. I tried that with my ASCII chart script, making that change. And it does (for me) show some Cyrillic. Not sure it's a complete solution though: http://www.rebol.org/view-script.r?script=ascii-chart.r | |
DanielP: 4-Feb-2009 | Hi. I have a 2-VID-windows program and I want to modify the layout (e.g add images) of the first window by clicking on buttons of the second window. How can I do that please ? | |
Brock: 5-Feb-2009 | There are some text objects below the radio buttons [RS S LS M L], that can be dragged from their current location and moved anywhere on the layout, not just the drawing area. These objects can be moved again at any point, and are not included in the overall draw dialect for the image area. | |
Geomol: 8-Feb-2009 | VID has many of the things needed: view layout [h1 "Heading 1" h2 "Heading 2" text "some text"] | |
Geomol: 8-Feb-2009 | view layout [text italic "italic text" text bold "bold text"] | |
Geomol: 8-Feb-2009 | To make to look good with italic and bold text in the middle, you can use the function SIZE-TEXT to get the layout sizes. | |
DideC: 9-Feb-2009 | I also give it a try. Not really a browser, just an HTML renderer with view/draw. But rendering HTML is a very complex thing to do, especially the layout, tables... So it is only able to render texte styles. | |
Anton: 14-Feb-2009 | Do you really need low-level access ? I suppose you don't mean simply this? view window: layout [my-image: image (make image! 100x100) button "set pixel" [my-image/image/(random 100x100): white show my-image]] | |
Anton: 14-Feb-2009 | img: make image! 300x200 window: layout [size (img/size)] window/image: img view window | |
Vladimir: 14-Feb-2009 | I did it.... :)img: make image! 320x200 window: layout [size (img/size + 100) button "set-pixel" [window/image/(random 100x100): white show window] ] window/image: img view window | |
Anton: 16-Feb-2009 | img: make image! 4x4 poke img 1x1 red poke img 2x2 white view layout [image img (img/size * 8)] | |
Vladimir: 16-Feb-2009 | I have my coffe and code now runs twice smoothly than first version :) www.visaprom.com/tunel.r And I tried that size trick: view layout [image img (img/size * 8)] and speed is the same..... | |
Henrik: 16-Feb-2009 | this requires some changes in the layout. | |
Anton: 16-Feb-2009 | The layout produces a face hierarchy like this: window face IMAGE face BUTTON face So that's two faces needing buffers refreshed whenever you do SHOW window. It's faster to have just one face (the window face). window face | |
Anton: 16-Feb-2009 | layout [ backcolor black origin 0 ekran: image ] | |
Vladimir: 16-Feb-2009 | aha..... I put show on 'ekran and speed is the same.... If Henrik's observation about replacing Show with prin... and that speed is the same... there is no need to mess with layout :) Is there some way of time profiling code ? how to find out wich part is slowest? By the way this script I want to use to make lookup tables for maping tunnel 3d coordinates onto screen so when I make those tables I can see if math is causing the slowdown.... And question for Anton, what did you use in your "Tunnel" demo.? show, direct image manipulation? or just effects for image datatype ? | |
Anton: 16-Feb-2009 | Actually, in my stargate demo (now that I look at it again more closely), I layout a window face with a single IMAGE face in it. I did this for some technical reason I can't remember, but I tried very hard not to make extra faces unnecessarily. |
501 / 2056 | 1 | 2 | 3 | 4 | 5 | [6] | 7 | 8 | ... | 17 | 18 | 19 | 20 | 21 |