0

I am trying to create a panel with dynamically created gui elements:

  sentlist: ["A" "B" "C"]
  main: function [slist] [
    view collect [
      keep [below]
      repeat i length? slist [
        keep[
            text slist/i    ; THIS STEP IS NOT WORKING
            field "" ] ] ] ]

  (main sentlist) 

A series of strings is sent to the function for putting text labels from it. The GUI window/panel is opening all right but text elements do not have any label on it. Where is the problem and how can it be solved? Thanks for your help.

rnso
  • 23,686
  • 25
  • 112
  • 234

1 Answers1

1
sentlist: ["A" "B" "C"]
main: function [slist] [
    view collect  [
        keep 'below
        repeat i length? slist [
            keep  compose [text (slist/:i) field "" ]
        ]
    ] 
]
main sentlist 
sqlab
  • 6,412
  • 1
  • 14
  • 29
  • By the way, this is the official formatting. Don't edit/deface it always. I do not understand that your editing of the formatting is accepted by reviewers – sqlab Sep 18 '17 at 13:54
  • I had tried `slist/:i` but not with parens `(slist/:i)` and also without `compose`. Can you provide some explanation about need for parens and compose keyword in your answer. Regarding the formatting, I do not think it is logical to keep closing braces on separate lines. Blocks of code are best seen by indentation and not closing braces/brackets. – rnso Sep 18 '17 at 16:14
  • I think it is logical. You see with ease and without counting closing brackets, if there is a missing bracket or more brackets. Compose evaluates/does only the parentheses in a block. – sqlab Sep 18 '17 at 16:20
  • Missing or extra brackets can easily be seen by good IDEs. Even otherwise, once code is working, one should pack away the closing brackets- open them later if some problem needs to be debugged. Of what use are 3 almost empty lines in your answer above. – rnso Sep 18 '17 at 16:47
  • Not everyone uses an IDE. A simple editor is always available on different platforms. Why format anew if problems arise? – sqlab Sep 18 '17 at 17:51
  • We should agree to disagree! I have a new question: https://stackoverflow.com/questions/46285290/printing-out-text-of-all-gui-elements-in-red-language – rnso Sep 18 '17 at 17:57