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

[REBOL] Re: change text of button...

From: carl:cybercraft at: 24-Dec-2003 22:21

On 29-Jun-03, Denis-Jo wrote:
> button "EEE" [e/texts: ["new" "more"] show e] ;not correct > e: rotary "RRR" "SSS" [] > button "FFF" [f/texts: ["new 111" "more 222"] show f]
> f: toggle "111" "222" [] > ] > Is it something for rotary ?
Try this... num: 0 view layout [ r: rotary "aaa" "bbb" button "Add Number" [ append r/texts to-string num show r num: num + 1 ] button "Select bbb" [ r/data: find r/texts "bbb" show r ] ] (Note that you can just copy & paste the above into the REBOL Console to run it - you don't need to save it as a REBOL script and then DO the script.) With the rotary style, both its 'texts and 'data words reference the block that contains the rotary's strings. The difference is in the words' indexes. 'texts's index points to the start of the block while 'data's index points to what's currently selected by the rotary. So to alter the strings in the rotary, alter the contents of the block that 'texts references. And to change what's selected in rotary, change the index of 'data. You can find out all the words a style has by probing the style after you exit back to the Console. This is what the rotary style (for 'r above) returns...
>> probe first r
[self type offset size span pane text color image effect data edge font para feel saved-area rate show? options parent-face old-offset old-size line-list changes face-flags action state style alt-action facets related words colors texts file var keycode reset styles init multi blinker pane-size dirty? help user-data flags effects] You can then look at the individual words like so...
>> probe r/texts
["aaa" "bbb"] == ["aaa" "bbb"]
>> probe r/data
["aaa" "bbb"] == ["aaa" "bbb"]
>> probe r/text
aaa == "aaa" and so on. If I'd changed the rotary before exiting, then r/data and r/text would show the change. Hope that helps. -- Carl Read