rebol

Printing out text of all GUI elements in Red language

懵懂的女人 提交于 2019-12-24 00:33:17
问题 I am trying to print out text from all GUI elements in following code: sentlist: ["A" "B" "C"] main: function [slist] [ view collect [ repeat i length? slist [ keep compose [ text (slist/:i) field "" return ]] keep [button "Printall" [ repeat i (2 * length? slist)[ print face/parent/pane/(i)/text ]]]]] (main sentlist) It runs all right without any error and text elements' text are properly printed out, but for fields , only last field's entry is printed out for each field. Where is the

How to invoke Rebol interpreter from the “Android Terminal Emulator”?

半城伤御伤魂 提交于 2019-12-23 18:50:32
问题 I need to invoke the Rebol language interpreter from the Android Terminal Emulator as a command that runs a script file (e.g. rebol script-name.reb ). So I'm not looking for an .APK app that launches only into the Rebol REPL, like that in https://github.com/angerangel/r3bazaar. I'd like to be able to run it as a shell command. 回答1: I cross-compiled r3 for android and seems ok. Here is the binary and here the source. Thanks @HostileFork for help and sources. 回答2: You can do this with a native

Evaluating a “variable variable”

人盡茶涼 提交于 2019-12-23 10:51:34
问题 I'm creating a dynamic variable ("Variable variable" in PHP parlance) with the following: foo: "test1" set to-word (rejoin [foo "_result_data"]) array 5 But how do I get the value of the resulting variable named "test1_result_data" dynamically? I tried the following: probe to-word (rejoin [foo "_result_data"]) but it simply returns "test1_result_data". 回答1: probe do (rejoin [foo "_result_data"]) from http://www.rebol.com/docs/core23/rebolcore-4.html#section-4.6 回答2: As your example code is

REBOL layout: How to create layout words automatically - word has no context?

时光毁灭记忆、已成空白 提交于 2019-12-23 08:37:14
问题 Using the REBOL/View 2.7.8 Core, I would like to prepare a view layout beforehand by automatically assigning words to various layout items, as in the following example. Instead of prepared-view: [across cb1: check label "Checkbox 1" cb2: check label "Checkbox 2" cb3: check label "Checkbox 3" cb4: check label "Checkbox 4" ] view layout prepared-view I would thus like the words cb1 thru cb5 to be created automatically, e.g.: prepared-view2: [ across ] for i 1 4 1 [ cbi: join "cb" i cbi: join

REBOL layout: How to create layout words automatically - word has no context?

自古美人都是妖i 提交于 2019-12-23 08:37:06
问题 Using the REBOL/View 2.7.8 Core, I would like to prepare a view layout beforehand by automatically assigning words to various layout items, as in the following example. Instead of prepared-view: [across cb1: check label "Checkbox 1" cb2: check label "Checkbox 2" cb3: check label "Checkbox 3" cb4: check label "Checkbox 4" ] view layout prepared-view I would thus like the words cb1 thru cb5 to be created automatically, e.g.: prepared-view2: [ across ] for i 1 4 1 [ cbi: join "cb" i cbi: join

A more elegant way to start a multithread alarm in Rebol VID ? (What's the equivalent of load event?)

泄露秘密 提交于 2019-12-23 04:43:19
问题 I want to trigger an alarm when the GUI starts. I can't see what's the equivalent of load event of other language in Rebol VID, so I put it in the periodic handler which is quite circumvoluted. So how to do this more cleanly ? alarm-data: none set-alarm: func [ "Set alarm for future time." seconds "Seconds from now to ring alarm." message [string! unset!] "Message to print on alarm." ] [ alarm-data: reduce [now/time + seconds message] ] ring: func [ "Action for when alarm comes due." message

Why are the 'context' and 'object' functions in Rebol different, but essentially the same?

五迷三道 提交于 2019-12-22 09:09:45
问题 On the one hand we have: >> source object object: make function! [[ "Defines a unique object." blk [block!] "Object words and values." ][ make object! append blk none ]] For context we see: >> source context context: make function! [[ "Defines a unique object." blk [block!] "Object words and values." ][ make object! blk ]] So, for object the object is constructed from a block to which none has been appended. This doesn't change the length, or, to my knowledge, add anything. With context , on

When I use error? and try, err need a value

白昼怎懂夜的黑 提交于 2019-12-21 19:17:34
问题 Here my function that execute cmd as a Rebol instructions : exec-cmd: func [ cmd [ block! ] "Rebol instructions" /local err ] [ if error? err: try [ do cmd ] [ print mold disarm err ] ] When I launch the function, I've encountered the following error message : ** Script Error: err needs a value ** Where: exec-cmd ** Near: if error? err: try [ do cmd ] How can I avoid this message and manage the error ? 回答1: When the Rebol default evaluator sees a sequence of a SET-WORD! followed by a

What is the 'reword' function in Rebol and how do I use it?

两盒软妹~` 提交于 2019-12-21 04:12:13
问题 I saw someone mention the reword function today, but documentation for it is very brief. It looks like shell script environment variable substitution, or maybe regex substitution, but different. How do I use this function and what kind of gotchas am I going to run into? 回答1: Here there be dragons! The reword function is a bit of an experiment to add shell-style string interpolation to Rebol in a way that works with the way we do things. Unlike a lot of Rebol's series functions, it really is

What's the fastest/most efficient way to count lines in Rebol?

情到浓时终转凉″ 提交于 2019-12-18 15:48:26
问题 Given a string string , what is the fastest/most-efficient way to count lines therein? Will accept best answers for any flavour of Rebol. I've been working under the assumption that the parse [some [thru]] combination was the fastest way to traverse a string, but then I don't know that for certain, hence turning to SO: count-lines: func [string [string!] /local count][ parse/all string [ (count: 1) some [thru newline (count: count + 1)] ] count ] Or: count-lines: func [string [string!] /local