You could do something kind of awkward like this:
getCurrentSession=: 3 : 0
smsel_jijs_ qsmout_jijs_'' NB. Select session form.
wd 'psel ',SMSEL_jijs_ NB. Select the parent window of session.
dat=. wd 'qd' NB. Get info about parent, including
ndx=. ({."1 dat) i. <,'e' NB. where "e" (session data) is.
>(<ndx,1){dat NB. Get session data as text vec.
)
askIfMoreIterations=: verb define
whitespace=. ' ',TAB,CRLF
tnit=. 0
smoutput ' Continue for more iterations? (enter "y" for yes) '
(1!:1) 1 NB. Wait for keyboard input...
ans=. _10{.getCurrentSession ''
ans=. ans}.~2+ans i: ')'
smoutput ' Answer received'
tnit=. 0$0
if. 'Y'=toupper {.ans-.whitespace do.
smoutput ' New total number of iterations (enter number): '
(1!:1) 1
ans=. _10{.getCurrentSession ''
ans=. ans}.~2+ans i: ':'
tnit=. ".ans-.whitespace
end.
tnit
)
NB. Call from another function:
foo=: 3 : 'askIfMoreIterations '''''
Or you could use a couple of simple windows like this:
NB. --- Window version ---
askIfMoreIterations=: verb define
{.wd 'mb Question "More iterations?" mb_yesno'
)
NB.* ASKITERATIONS: define simple window to get number of iterations in
"NUMITER".
ASKITERATIONS=: 0 : 0
pc askiter;
xywh 140 8 34 12;cc ok button;cn "OK";
xywh 140 23 34 12;cc cancel button;cn "Cancel";
xywh 5 8 55 10;cc inpBoxTxt static;cn "Number of iterations:";
xywh 60 8 15 10;cc NUMITER edit;
pas 6 6;pcenter;ptop 1;
setfocus NUMITER;
rem form end;
)
askiter_close=: 3 : 0
wd'pclose'
)
askiter_cancel_button=: 3 : 0
askiter_close''
)
askiter_ok_button=: 3 : 0
askiter_close''
)
getIterationsIfAny=: 3 : 0
if. 'y'=tolower askIfMoreIterations '' do.
wd 'pshow' [ wd ASKITERATIONS
else. 0$0 end.
)
On 1/9/07, Roelof K. Brouwer <[EMAIL PROTECTED]> wrote:
The J session manager
cheers
Roelof
Contact information
Dr. Roelof K. Brouwer PEng
Professor
Department of Computing Science
School of Advanced Technologies and Mathematics
Thompson Rivers University
900 McGill Road, PO Box 3010
Kamloops, BC, Canada,V2C 5N3
skype RoelofBrouwer
telephone numbers
1-250 828 5219 work
1-250-374-5874 home
1-250-377-6133 fax
home page www.tru.ca/advtech/compsci/faculty/rbrouwer
email [EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Devon McCormick
Sent: January 8, 2007 4:42 PM
To: General forum
Subject: Re: [Jgeneral] keyboard input
Are you running the J session manager or jconsole?
On 1/8/07, Roelof K. Brouwer <[EMAIL PROTECTED]> wrote:
>
> Sorry I forgot to say that sco represents
> 1!:2&2
>
> The operating system is windows XP and I am running J 601a
>
>
>
> cheers
>
> Roelof
>
> Contact information
>
> Dr. Roelof K. Brouwer PEng
> Professor
> Department of Computing Science
> School of Advanced Technologies and Mathematics
> Thompson Rivers University
> 900 McGill Road, PO Box 3010
> Kamloops, BC, Canada,V2C 5N3
>
> skype RoelofBrouwer
> telephone numbers
> 1-250 828 5219 work
> 1-250-374-5874 home
> 1-250-377-6133 fax
> home page www.tru.ca/advtech/compsci/faculty/rbrouwer
> email [EMAIL PROTECTED]
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED]
> On Behalf Of Miller, Raul D
> Sent: January 7, 2007 5:10 PM
> To: General forum; General forum
> Subject: RE: [Jgeneral] keyboard input
>
> Roelof K. Brouwer wrote:
> > The function below causes J to wait for input as expected and gives me
> > temp 0
> > continue for more iterations ? put in y for yes
>
> I get
> |value error: sco
>
> However, setting sco=: smoutput fixes that problem.
>
> > When I include the code inside the verb in another verb I get the
> > following . J does not wait for input
>
> I do not experience this problem.
>
> Sample session:
>
> foo=:3 :0
> temp 0
> )
> foo''
> continue for more iterations ? put in y for yes
> y
> answer received
> new total number of iterations
> 6
>
> Perhaps you could be more specific about what you are doing? (Including
> OS and which executable you are running.)
>
> Thanks,
>
> --
> Raul
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm