I use wd 'wait' as a lightweight way to get something like a password. Henry Rich
On 2/21/2012 5:17 AM, bill lam wrote: > I guess these are really ancient codes. the wd'wait' is rarely used in > modern J base libary or addons code, and the gtkwd does not support > it. And wd'q' will raise domain error if there is no event after > the previous wd'q' > > You code fragment is incomplete so that I cannot know what it is > suppose to do. You should put event-driven code inside either form_default > or form_child_button. eg, if there is a button with an id 'foo' > > form_foo_button=: 3 :0 > k=. wdq > if. (*/'show' = 4{.>9{{:"1 k) +. */'pain' = 4{.>9{{:"1 k do. > if. */'pain' = 4{.>9{{:"1 k > ..... > ) > > Often wdq need not used, because the value of child will be > automatically assigned. Please read the chapter on 'window driver' > in "j user manual" accessible from j602 help for some background. > > Втр, 21 Фев 2012, Linda Alvord писал(а): >> Here is the code that causes my trouble. I have Debugwd_gtkwd_=:1 way at >> the beginning. >> >> wd 'setfont clear "MS Sans Serif" 11' >> wd 'setfont cancel "MS Sans Serif" 11' >> smoutput 'a0' >> label_there. >> smoutput 'a1' >> while. 1 do. >> smoutput 'a2' >> wd 'wait' >> k=:wd 'q' >> smoutput 'a3' >> if. >> smoutput 'a4' >> (*/'show' = 4{.>9{{:"1 k) +. */'pain' = 4{.>9{{:"1 k >> do. >> if. >> */'pain' = 4{.>9{{:"1 k >> >> here's where I go astray: >> >> wd 'setfont clear "MS Sans Serif" 11' >> wd 'setfont cancel "MS Sans Serif" 11' >> smoutput 'a0' >> label_there. >> smoutput 'a1' >> while. 1 do. >> smoutput 'a2' >> wd 'wait' >> k=:wd 'q' >> smoutput 'a3' >> if. >> smoutput 'a4' >> >> since I haven't used this code since J4 I can't remember what I would get in >> 'q' but I must have been able to collect some data I wanted but I don't >> know what it was back then. >> >> Any ideas? >> >> Linda >> >> >> -----Original Message----- >> From: programming-boun...@jsoftware.com >> [mailto:programming-boun...@jsoftware.com] On Behalf Of bill lam >> Sent: Tuesday, February 21, 2012 1:49 AM >> To: programming@jsoftware.com >> Subject: Re: [Jprogramming] Control error when loading script into ijx >> window (J602) >> >> I would suspect H L C are undefined. My general approach is to >> insert smoutput before and after every control switch, eg >> >> smoutput 'a1' >> for_i. i.(#a) do. >> smoutput 'a2' >> >> currHi=. ".> (i { H) >> currLo=. ".> (i { L) >> currCl=. ".> (i { C) >> >> if. (0=i) do. >> smoutput 'a3' >> diffHi=. 0 >> diffLo=. 0 >> else.<-------- control error here >> smoutput 'a4' >> prevHi=. ".> ((i-1) { H) >> prevLo=. ".> ((i-1) { L) >> diffHi=. currHi - prevHi >> if. 0<:diffHi do. pivotHi=. currHi end. >> smoutput 'a5' >> diffLo=. prevLo - currLo >> if. 0<:diffLo do. pivotLo=. currLo end. >> smoutput 'a6' >> end. >> >> smoutput 'a7' >> if. diffLo>diffHi do. >> smoutput 'a8' >> if. currLo<: ( pivotHi * (1-swing) ) do. >> smoutput 'a9' >> xx=. xx , currLo >> >> Втр, 21 Фев 2012, PackRat писал(а): >>> When loading a script to test, I get an immediate "control error" when >>> I give the command to load it. The following is the portion of the >>> script that has all of the control structures. I've drawn an arrow >>> pointing to the line where the error is supposed to have occurred. I'm >>> probably "blind" to the error because I'm just not seeing the problem. >>> >>> ================================================================ >>> >>> for_i. i.(#a) do. >>> >>> currHi=. ".> (i { H) >>> currLo=. ".> (i { L) >>> currCl=. ".> (i { C) >>> >>> if. (0=i) do. >>> diffHi=. 0 >>> diffLo=. 0 >>> else.<-------- control error here >>> prevHi=. ".> ((i-1) { H) >>> prevLo=. ".> ((i-1) { L) >>> diffHi=. currHi - prevHi >>> if. 0<:diffHi do. pivotHi=. currHi end. >>> diffLo=. prevLo - currLo >>> if. 0<:diffLo do. pivotLo=. currLo end. >>> end. >>> >>> if. diffLo>diffHi do. >>> if. currLo<: ( pivotHi * (1-swing) ) do. >>> xx=. xx , currLo >>> else. >>> xx=. xx , ( {: xx ) NB. repeat previous value >>> end. >>> else. >>> if. currHi>: ( pivotLo * (1+swing) ) >>> xx=. xx , currHi >>> else. >>> xx=. xx , ( {: xx ) NB. repeat previous value >>> end. >>> end. >>> >>> end. >>> >>> ================================================================ >>> >>> The same error (at the same line) occurs if the following lines: >>> >>> if. 0<:diffHi do. pivotHi=. currHi end. >>> . . . >>> if. 0<:diffLo do. pivotLo=. currLo end. >>> >>> are instead expanded to: >>> >>> if. 0<:diffHi do. >>> pivotHi=. currHi >>> end. >>> . . . >>> if. 0<:diffLo do. >>> pivotLo=. currLo >>> end. >>> >>> >>> I would appreciate any assistance in "opening my eyes"--thanks in >>> advance! >>> >>> >>> Harvey >>> >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >> >> -- >> regards, >> ==================================================== >> GPG key 1024D/4434BAB3 2008-08-24 >> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm