REBOL Forum Recent REBOL Forum Topics http://rebolforum.com Modifying a VID gui at run time All VID FACES are OBJECTs. LAYOUT is simply a convenient way of making a load of FACES in one go, and it handles lots of useful things like working out each FACE's offset. Every FACE OBJECT has a /PANE block. In the case of your tiles, they are the bottom of the FACE hierarchy, so they each have an empty /PANE block. You can look at the basic information for a FACE and any FACES contained in its /PANE block like this: dump-face lo-mgui LAYOUTs can be more complicated than that - your TILEs could contain other FACEs in their /PANEs - and so on. Here's a very simple example of a FACE hierarchy that is two levels deep: dump-face view/new layout [ across panel 100x100 white [box 50x50 red box 20x20 blue] panel 100x100 pink [box 40x40 green box 30x30 yellow] ] LAYOUT generates OFFSETs (in accordance with your DOWN or ACROSS) relative to the /PANE in which the FACE appears. If we had not put an OFFSET in the LAYOUT in ADD-TILE, all the new tiles would have default offsets of 10x10 - so they'd overlay your first Red Tile - delete the NEW-TILE/OFFSET line and you should see that behavior. If you want the new tile to go somewhere relative to existing tiles in the same PANEL, then you need to replace the NEW-TILE/OFFSET line with a more sophisticated version of: last-old-tile: last lo-mgui/pane new-tile/offset: 0x40 + last-old-tile/offset UNVIEW/ALL is helpful, especially if you have been doing VIEW/NEW .... DO-EVENTS - it clears all the old GUI windows. VIEW/NEW ... DO-EVENTS is helpful as it gives you access to both the console, and the GUI. Try this: unview/all view/NEW lo-mgui: layout mgui The GUI appears, but does not respond to clicks. You can still use the console, eg: print length? lo-mgui/pane print lo-mgui/size lo-mgui/pane/1/color: black show lo-mgui To get the GUI to start working, type in the console: DO-EVENTS A good introduction to making FACES dynamically is here: http://www.rebol.com/docs/view-face-funcs.html , Posted by: Sunanda 22-Sep-2019/20:47:10-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=37&archiveflag=new comparing characters in a string with pick Also see: http://www.rebol.com/faq.html#056 If you study that little FAQ response, you will understand it better. , Posted by: Stone Johnson 20-Sep-2019/13:23:26-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=36&archiveflag=new Is flood (from the VID dialect) broken? You are right! The example given does not match the picture., Posted by: Stone Johnson 31-Aug-2019/16:11:51-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=35&archiveflag=new Parsing a Python line; why does this even work? From Chapter 15 of the REBOL Core Manual: Parsing splits a sequence of characters or values into smaller parts...parse ... has the general form: parse series rules The series argument is the input [to be] parsed and can be a string or a block. If the argument is a string, it is parsed by character. ... parse ... also accepts two refinements: /all and /case. The /all refinement parses all the characters within a string, including all delimiters, such as space, tab, newline, comma, and semicolon. ... parse ... normally ignores all intervening whitespace between patterns that it scans. To enforce a specific spacing convention, use parse with the /all refinement. ... parse ... splits the input ... string into a block of multiple strings, breaking each string wherever it encounters a delimiter Thus: parse/all ODBC-CONNECTIONS "=^/" Says this: parse all characters in the string splitting only each encountered equal sign and each encountered newline. Try something simplier first: >> parse "Test1=This Test2=That" "=^/" == ["Test1" "This" "Test2" "That"] or the string spanning two lines: >> parse first [ {Test3=this { Test4=that}] "=^/" == ["Test3" "this" "Test4" "that"] Without the /all refinement, parse breaks on the =, the " " and the invisible newline, see: >> newline == #"^/" Now, what happens with the /all refinement? >> parse/all "Test1=This Test2=That" "=^/" == ["Test1" "This Test2" "That"] Because REBOL is now checking every character, including ones not visible to you, i.e., space, REBOL uses parse to break on = which gives: "Test1" and then it passes the space because it has no rule for it and finds the next equal, which it splits on, which gives: "This Test2" And then it finds the newline at the end of the second that, which gives: "That" With a string spanning lines, what happens? >> parse/all first [ {Test3=this { Test4=that}] "=^/" == ["Test3" "this " "Test4" "that"] REBOL using parse breaks on = "Test3" and then on newline "this " and then on = "Test4" and then on newline "that" , Posted by: Stone Johnson 24-Aug-2019/15:20:25-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=34&archiveflag=new Referring to next/prev series entries Given: x: [] loop 10 [append x make object! [r: random 100]] From the answers above, this does not work: forall x [print x/1/r - x/-1/r] And yes, Chris caught his error. Proof: >> forall x [print x/1/r - x/-1/r] ** Script Error: Cannot use path on none! value ** Where: forskip ** Near: forall x [print x/1/r - x/-1/r] However, this does: out1: copy [] n: 2 until [ append out1 reduce [x/(n)/r - x/(n - 1)/r] n: n + 1 n = (1 + length? x) ] Proof: out2: copy [] x: head x forskip x 2 [ append out2 reduce [negate x/1/r '+ x/2/r] if not none? ok: attempt [ reduce [negate x/2/r '+ x/3/r]][append out2 ok] ] print out1 print reduce out2 , Posted by: Stone Johnson 23-Aug-2019/18:17:41-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=33&archiveflag=new Parsing baby steps hr: head-rules: [ 3 "=" copy hgd some [letter | figure] to newline ( append page maketag 'h1 hgd ) ] pr: para-rules: [ copy pg some letter copy x figure dash copy y figure to newline ( append page maketag 'p rejoin [pg " " x "-" y] ) ] maketag: func [ tag [word!] text [string!] ][ rejoin ["" build-tag reduce [tag] text build-tag to-block rejoin ["/" tag]] ] rules: [ any [() newline | some head-rules | some para-rules] to end ] >> parse md rules == true >> page == {<h1>Heading 1</h1><p>Paragraph 1-1</p><h1>Heading 2</h1><p>Paragraph 2-1</p>} , Posted by: REFACTORING FROM ABOVE 21-Aug-2019/1:58:13-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=32&archiveflag=new Explaining parse rules Errata: In 3. 1 or more times consume characters 1 or more times consume delimiters , Posted by: Stone Johnson 21-Aug-2019/0:23:21-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=31&archiveflag=new Rebol vs. FizzBuzz Addendum: | is a word of my Red instance, which returns a float! in Red because Red only returns the whole number part of a quotient when dividing and tosses away the fractional part. USAGE: value1 / value2 DESCRIPTION: Returns the quotient of two values. / is an op! value. ARGUMENTS: value1 [number! char! pair! tuple! vector! time!] "The dividend (numerator)." value2 [number! char! pair! tuple! vector! time!] "The divisor (denominator)." RETURNS: [number! char! pair! tuple! vector! time!] REBOL 2.7.8 does not have this problem., Posted by: Stone Johnson 20-Aug-2019/23:46:54-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=30&archiveflag=new Parse pattern matching ;; Here is how I do it. ;; First, I write out what needs to be done in p-code. ;; And then I try code at the console ;; For every file, i.e., for all ;; REBOL should try to match those beginning with CV ;; while ignore the rest of the filename crud ;; REBOL should add those that have matched to a block names: copy [] forall filenames [ parse filenames/1 [ "CV" skip to end ( append names filenames/1 ) ] ] ;; non-parse way names: copy [] forall filenames [ if equal? 1 index? find filenames/1 %CV [append names filenames/1] ] Why? Hint: We're asking REBOL to append to a block! only those finds that have a "head view," i.e., have an index position of one See? views: copy [] forall filenames [ if i: index? find filenames/1 %CV [ append views join "view of find starts at: " i ] ] new-line/all views on probe views, Posted by: Stone Johnson 20-Aug-2019/23:23:34-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=29&archiveflag=new More parsing confusion Errata for the above: This: you have told REBOL to give you a view of the string! from index position of 3. Should be: This: you have told REBOL to give you a view of the string! from index position of 4. , Posted by: Stone Johnson 20-Aug-2019/17:29:26-7:00 http://rebolforum.com/index.cgi?f=printtopic&topicnumber=28&archiveflag=new