Ask
[1/17] from: ammoncooke:yah:oo at: 26-Sep-2001 11:21
Hi,
I am trying to use 'ask in one of my scripts:
view ask reform ["which layout; " lyts "? "]
at the prompt I type:
pn1
** Script Error: view expected view-face argument of type: object
** Where: do-boot
** Near: view ask reform ["which layout; " lyts "? "]
>>view pn1
the layout is displayed properly. Why? I have tried:
lyt: ask reform ["which layout; " lyts "? "]
view reform[lyt]
but that returns the same error. Somehow there has got to be a way to tell REBOL that
the value has a value. ;)
Thanks!!
Ammon
[2/17] from: cybarite:sympatico:ca at: 26-Sep-2001 14:00
Hi
The result of an Ask is a string. Try
ask "What do I get?"
and view is expecting a block.
I don't think "ASK" is what you want. But you can make it work
by doing something like
blocks: [
one [button 200x24 water "Button One"]
two [size 400x400 across button 200x24 water "Button Two"]
]
my-choice: ask "Enter an identifier (one or two): "
view layout select blocks to-word my-choice
You might want to look at other options that are not so dependent
on the user typing exactly what you expect... choice and rotary
might be appropriate.
No reply needed.
At 11:21 AM 9/26/01 -0700, you wrote:
[3/17] from: al:bri:xtra at: 27-Sep-2001 7:30
Ammon wrote:
> I am trying to use 'ask in one of my scripts:
>
> view ask reform ["which layout; " lyts "? "]
This page on subpanels in View might be helpful:
http://www.rebol.com/how-to/subpanels.html
Andrew Martin
ICQ: 26227169 http://zen.scripterz.org
[4/17] from: thundrebol:yaho:o at: 26-Sep-2001 12:30
Hi Ammon--
From your example, it's not clear what you need but...
View requires a face object or the result of a layout
block. You need to defer calling View until you can
supply those args.
Ask is reserved for collecting user input from the
console window. If you want to gather input from the
console and *then* use View to produce an interface,
try something like (assuming lyts is defined):
result: ask reform ["Which layout; " lyts "?"]
lay: layout [
h2 gold "You selected:"
content: text black 200 ""
]
content/text: result
show content
view lay
If the View engine is already engaged, request-text is
the preferred method. Try (again, assuming lyts is
defined):
lay: layout [
h2 gold "Select a layout"
content: text black 200 "Click Ask to continue."
button "Ask" [
answer: request-text/title reform [
"Which layout " lyts "?"
]
clear content/text
content/text: answer
show content
]
]
view lay
The Text Fields How-To doc
(http://www.rebol.com/how-to/fields.html#sect3.2.)
gives some examples of this.
HTH,
Ed
--- Ammon Cooke <[ammoncooke--yahoo--com]> wrote:
[5/17] from: ammoncooke::yahoo::com at: 26-Sep-2001 15:00
I guess the real question is "How to get a string to point to an object?"
Thanks!!!
Ammon
[6/17] from: al:bri:xtra at: 27-Sep-2001 8:30
Ammon asked:
> I guess the real question is "How to get a string to point to an object?"
>> b: reduce [
[ "View 1" make object! [
[ m: 123
[ ]
[ "View 2" make object! [
[ m: 456
[ ]
[ ]
== [
"View 1"
make object! [
m: 123
]
"View 2"
make object! [
m: 456
]]
>> o: select b "View 2"
>> probe o/m
456
== 456
I hope that helps!
Andrew Martin
Off to have breakfast...
ICQ: 26227169 http://zen.scripterz.org
[7/17] from: ammoncooke::yahoo at: 26-Sep-2001 17:08
That is enlightening, but does not do what I want. I was just looking for a
quick, & dirty solution, I shouldn't ever look for quick & dirty. ;) I got
what I need though.
Thanks!!
Ammon
[8/17] from: cyphre:volny:cz at: 27-Sep-2001 9:31
Hi Ammon,
try this solution:
x: layout [text "hello"]
view do ask "which layout?" ;answer 'x' and the layout should be shown
regards,
Cyphre
[9/17] from: coussement:c:js:mil:be at: 27-Sep-2001 10:41
[10/17] from: ammoncooke:yah:oo at: 27-Sep-2001 4:03
close, but I need text entry.
Thanks!!
Ammon
----- Original Message -----
From: "CRS - Psy Sel/SPO, COUSSEMENT, Christophe, CPN"
<[COUSSEMENT--C--js--mil--be]>
[11/17] from: sanghabum:aol at: 27-Sep-2001 7:52
Hi ammon
> close, but I need text entry.
>
Does Request-text get closer?
--Colin
[12/17] from: ammoncooke::yahoo at: 27-Sep-2001 10:04
Nope! Same effect as 'ask:
** Script Error: view expected view-face argument of type: object
** Where: do-boot
** Near: view request-text reform ["which layout; " lyts "? "]
>> view pn1
>> view "pn1"
** Script Error: view expected view-face argument of type: object
** Near: view "pn1"
>>
That was with pn1 typed in the request-text box. As you can see 'pn1 is an
object of type 'layout, but both 'request-text, & 'ask return a string
value. How do I get that value to reference the object!?
Thanks!!
Ammon
[13/17] from: ammoncooke:ya:hoo at: 27-Sep-2001 10:14
It is, but the layouts I am trying to view have been DOne. The only place
they exist in the raw format is in a complex block. Thus my question, "how
to make a string *point* to an object.
Thanks!!
Ammon
[14/17] from: al:bri:xtra at: 28-Sep-2001 3:23
Ammon asked:
> How do I get that value to reference the object!?
>> pn1: [text "I'm pn1"]
== [text "I'm pn1"]
>> view layout get to-word ask "What layout (pn1)? "
What layout (pn1)? pn1
... and then the layout is shown.
Andrew Martin
Can't sleep, must Rebol...
ICQ: 26227169 http://zen.scripterz.org
[15/17] from: al:bri:xtra at: 28-Sep-2001 3:39
Ammon asked (eventually):
> how to make a string *point* to an object?
>> o: make object! [m: 123]
>> probe get to-word ask "what object? "
what object? o
make object! [
m: 123
]
Caution this doesn't have any error checking:
>> probe get to-word ask "what object? "
what object? blahblah
** Script Error: blahblah has no value
** Near: probe get to-word ask "what object? "
Far better to have text list for the operator to choose from, or a choice of
several buttons to click on.
Andrew Martin
ICQ: 26227169 http://zen.scripterz.org
[16/17] from: cyphre:volny:cz at: 27-Sep-2001 17:56
Ammon,
I'm not sure if you oversought my reply or I just don't understand your
peoblem but try this:
-----
a: layout [text "hello world"]
view do request-text/title "which layout?"
-----
if you enter 'a' into field layout 'a should be shown...
regards,
Cyphre
[17/17] from: ammoncooke::yahoo at: 27-Sep-2001 11:33
Um... I feel a little sheepish now, I did overlook it on the pretence that
it looked like the rest of replies I got. ;( BUT it turns out that it was
about 3 characters different; I just needed 'do in there.
Thanks!!
Ammon
PS In the future I will more fully scrutinize EVERY reply. ;)