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

[REBOL] Can this be done?

From: Steven::White::ci::bloomington::mn::us at: 23-Apr-2003 10:01

I see a deficiency in the REBOL documenatation. It is possible to find out what a given function does, but it is hard to go in reverse, to find out which function to use to execute a given idea. I want to write a function that will pop up an alert box with text based on a message number that is passed to the function. The "alert" function will take a data name that identifies its text, but it does not seem to take a data name which identifies the NAME of the text--sort of like double indirect addressing. I have enclosed a sample script that shows what I want to do. The key statement is the "alert" statement. I am wondering if there is some function that can be applied to MSG-ID so that REBOL will evaluate MSG-ID to get the name of the message, and then evaluate the name of the message to get the actual message. Thank you. ##################################### This is a test program to find out how to make an alert box with a variable message. REBOL [ ] ; -- These are the possible message texts that can go ; -- in the alert box. Each is identified by a name ; -- that consists of a literal "MSG-" followed by ; -- a unique three-digit number. ; MSG-001: "This is message number one" MSG-002: "This is message number two" ; -- This function displays an alert box with message ; -- text based on a three-digit number passed to the ; -- function. The function uses the three-digit number ; -- to create a name for the message text, and then ; -- uses that name to get the message text. ; -- (At least, that is the plan, since this does not ; -- work.) SHOWALERT: func [ ; ; -- description of the function and its parameters -- ; "Display alert box with message based on passed message number" MSG-NUMBER [string!] "Message number as three-byte string" ][ ; ; -- the "code" for the function -- ; ; -- Generate the word whose value is the NAME of the desired text ; MSG-ID: append "MSG-" MSG-NUMBER ; ; -- Pop up an alert box containing the desired text. ; -- MSG-ID will evaluate to MSG-nnn where nnn is the message ; -- number. We would like the value of MSG-ID to be evaluated ; -- AGAIN to obtain the text that is the value of the word ; -- that is the value of MSG-ID--a bit of double indirect ; -- addressing. ; alert [ MSG-ID "CLEAR" ] ] SHOWALERT "001" print "Returned from SHOWALERT function" ;###### end of sample script ############## Steven White City of Bloomington 2215 W Old Shakopee Rd Bloomington MN 55431-3096 USA 952-563-4882 (voice) 952-563-4672 (fax) [swhite--ci--bloomington--mn--us]