Simple 'choice' example?
[1/8] from: bpaddock:csonline at: 17-Nov-2001 10:19
I'm stuck on a simple problem, hope some one can help me out.
First of all is there any one URL or REB site that has link to all of the
various HowTo's and Docs? I've looked for the last hour trying to find
some thing that would explain what I'm doing wrong, but with out luck.
I want a 'choice' button that returns some text such as "Dog", "Cat", "Duck",
then pass this to a function.
Problem is when I get to the function, shown below it prints out the message
?OBJECT?
.
Assuming I get that working, how do I get 'choice' to return a block and pass
that block to a function?
REBOL [
]
GetPatent: func [
PatentSever
PatentNumber
] [
; Prints out ?object?, WHY???
print PatentServer
; Does the right thing:
print PatentNumber
]
; Derived from emailsend.r:
view layout [
backdrop 30.40.100 effect [grid 10x10]
origin 40x20
PatentServer: choice "EP" "US" "WO"
msg: field "Enter WO Patent Number here..." 210
text white "Options:"
across return
button "Get Patent" [GetPatent PatentServer msg/text]
return
button "Quit" [quit]
]
do-events
[2/8] from: philb::upnaway::com at: 18-Nov-2001 0:17
Hi,
try using PatentServer/text in the function call
Cheers Phil
=== Original Message ===
I'm stuck on a simple problem, hope some one can help me out.
First of all is there any one URL or REB site that has link to all of the
various HowTo's and Docs? I've looked for the last hour trying to find
some thing that would explain what I'm doing wrong, but with out luck.
I want a 'choice' button that returns some text such as "Dog", "Cat", "Duck",
then pass this to a function.
Problem is when I get to the function, shown below it prints out the message
?OBJECT?
.
Assuming I get that working, how do I get 'choice' to return a block and pass
that block to a function?
REBOL [
]
GetPatent: func [
PatentSever
PatentNumber
] [
; Prints out ?object?, WHY???
print PatentServer
; Does the right thing:
print PatentNumber
]
; Derived from emailsend.r:
view layout [
backdrop 30.40.100 effect [grid 10x10]
origin 40x20
PatentServer: choice "EP" "US" "WO"
msg: field "Enter WO Patent Number here..." 210
text white "Options:"
across return
button "Get Patent" [GetPatent PatentServer msg/text]
return
button "Quit" [quit]
]
do-events
[3/8] from: bpaddock:csonline at: 17-Nov-2001 11:36
> try using PatentServer/text in the function call
If you mean change it to this:
button "Get Patent" [GetPatent PatentServer/text msg/text]
it still gives me the same error: ?object?
Where are the refinements like /text documented?
[4/8] from: lmecir:mbox:vol:cz at: 17-Nov-2001 17:54
Hi Bob,
how about changing 'PatentSever to 'PatentServer?
[5/8] from: ammonjohnson:yah:oo at: 17-Nov-2001 11:25
Ah, Ladislav beat me to the Typo part, but for your enlightenment...
Any face is an object! by defining PatentServer as a choice you have made
it an object! & it was
Try this at the console:
>> layout [c: choice "Option1" "Option2"]
>>probe first c
This will list the words in 'c. to see their values:
>> probe c
For more information on objects check Core.pdf
(http://rebol.com/download_manual.html) Look at the Objects Section.
HTH
Ammon
[6/8] from: bpaddock:csonline at: 17-Nov-2001 12:32
> how about changing 'PatentSever to 'PatentServer?
Yep, that fixed it. If only I could have found some documentation
that said "?object?" means "undefined variable or parameter". Spent to much
time staring at it.
I'll go crawl back under my rock for a while after that embarrassing fopaw...
[7/8] from: ammonjohnson:y:ahoo at: 17-Nov-2001 12:03
Sorry, I pressed send too soon, What I was saying is that your code "print
PatentServer" was not printing an undefined word! If it would have been, it
would have told you so. It was attempting to print the object declared in
the Global Context, which happend to be an object! to see this in action:
>> print make object! []
== ?object?
HTH
Ammon
[8/8] from: jasonic:panix at: 17-Nov-2001 18:33
> First of all is there any one URL or REB site that has link to all of the
> various HowTo's and Docs? I've looked for the last hour trying to find
> some thing that would explain what I'm doing wrong, but with out luck.
http://www.google.com
much better than RT's site