For a little project, and also for my education, I want to make a function to which I can pass a block of stuff and have it pop up a window with a text-list of that stuff, and then return what is picked from the text-list. An abbreviated sample is shown below. It does not seem to return what is picked (or "none" if nothing is picked), but instead returns some REBOL source code. I include a test function, GET-EMAIL-X, to show that my calling methodology is correct, so the problem must be in my use of the "inform" function inside of a function. I wonder if this can be done, or if I am doing something wrong.
Thank you.
R E B O L []
;; This is what I want to do but it does not return the right result.
GET-EMAIL: func [
EMAIL-LIST
/local PARSED-EMAIL
] [
inform ADDR-LIST: layout [
ADDRS: text-list 300x400 data EMAIL-LIST [
PARSED-EMAIL: first ADDRS/picked ":"
hide-popup ADDR-LIST
return PARSED-EMAIL
]
button "Close" [
hide-popup ADDR-LIST
return none
]
]
]
;; This shows the test code is correct because it does return a result.
GET-EMAIL-X: func [
EMAIL-LIST
] [
return first EMAIL-LIST
;; return none
]
;;Uncomment to test
;RESULT: GET-EMAIL-X [ ;; This does what is expected.
RESULT: GET-EMAIL [ ;; RESULT will have some sort of source code.
"adam@gmail.com"
"benjamin@gmail.com"
]
print "probe RESULT to see what happens."
halt