Hi Brian,

The prefix comes from the suggestion of the object oriented  
programming lab and although this is not a class but a locale, I  
thought the prefix might be useful to avoid conflicts - especially  
when the name of the locale is something potentially common like  
Visual. I may be out to lunch on doing the naming this way, but that  
was my reasoning.

BTW the rgt stands for robert george therriault. I'd actually be  
happier with an alternative prefix (if one is required) since rgt does  
not reflect  the contributions of Don, Ric, Bill and yourself). Since  
I am still hoping to extend this approach to GUI a bit further, it may  
make sense to come up with a prefix for the locale that reflects the  
intention. Maybe 'vji' for visual j interface? (prefixes starting with  
j are reserved for j classes, p for personal use).

I'm looking at the suggestions for the reduction of mouseclicks through

  display_cancel=: display_close

but bill lam's suggestion (from another post) of closeok in the  
dialogue definition doesn't seem to work for my MacBook Pro. So, while  
the ESC key is available on Mac laptops it may need some massaging.  
Mac laptops require a fn key to enable F key functionality and ESC may  
have some similar approach. I'm still looking at this as a quick exit  
is always nice.

With your index error question, I thought at first it was just the  
fact that you were using

display ''

and the empty list argument was creating the problem. But I found when  
I started a new J session, I consistently got an error ( syntax error:  
update  sidx=. {.2 4 5 6 2{~I.99".>RBFORMAT wdget wdq)
even when I had a valid argument on the first invocation of display. I  
think this may have something to do with when the value of box (edit  
control) is set, but I'm looking into this as well. (Bill Lam's post  
solves this problem by forcing the examination of edit box contents  
through   wdget wd'qd' . Very cool)

Cheers, bob

ps. excellent job on the screencasts. If J is to attract a wider  
audience, these user friendly introductions will be vital.



On -Apr29-2009, at -Apr29-20095:57 AM, Brian Schott wrote:

> I agree that Ric's rehash is terrific and a diff between the two
> scripts really helped me appreciated both of you work a great deal.
> And Bob's making points of changes helped even more.
>
> I am unclear what the "rgt" prefix describes.
>
> I try to avoid mouse clicks so I especially appreciate when windows
> can be closed with a keystroke. Therefore I like when programs include
> a phrase like
>
> display_cancel=: display_close
>
> Ric's code includes a  similar phrase, but it does not work for me in
> the way I prefer (on my Mac) with keystrokes.
>
> NB. display_cancel_button=: display_close
>
> Another problem for me is that the wdget does not seem to work for me
> on my Mac. I get the following error upon loading the script.
>
> |index error: wdget
> |   vls    {~nms i.,&.>x
>
> This has been a pleasure to peruse.
>
> On Wed, Apr 29, 2009 at 1:25 AM, bob therriault  
> <bobtherria...@mac.com> wrote:
>> Thank you Ric,
>>
>> Giving the "display" verb an argument cleans up the preset of '+/ 
>> %#' I
>> had used as a default for the form and additionally allows the user  
>> to
>> invoke the verb from the J IDE as needed. This means that display
>> 'insert tacit function here' gives the user an immediate view of  
>> their
>> tacit function in the form.
>>
>> The inclusion of the Unicode box drawing characters is a feature I  
>> had
>> not considered and it certainly cleans up the display. Using the  
>> radio
>> buttons the way you have certainly simplifies the script, but I will
>> need to play with it for a while to get a better understanding of   
>> the
>> wdget wd q;  information conduit. I had not considered that as a way
>> to specify the states of the radio buttons and it seems to me a very
>> powerful concept.
>>
>> One question I had was whether there is any risk of overwriting an
>> existing function with the line, display_z_=: display_rgtVisual_ I
>> checked and there are no existing verbs named display in the z  
>> locale,
>> but it seems to me that it may be possible to overwrite a verb of the
>> same name if it existed. It is certainly nice to have the convenience
>> of it in the z locale as it is easy to invoke from the .ijx window,
>> but I wouldn't want to cause unexpected side effects to other  
>> programs.
>>
>> Finally, a thing that you didn't mention but I think is a very strong
>> feature is the use of 13!:12 to display a meaningful message when the
>> input is not in tacit form.
>>
>> Thank you again for your suggestions. I certainly have a way to go in
>> learning this language, but your support makes it a tremendously
>> enriching and concept expanding experience. This really is great
>> community.
>>
>> Cheers, bob
>>
>> p.s. Do you think this form is a useful tool? As a novice I find it
>> helps with the analysis of tacit expressions, but is that usefulness
>> an illusion when viewed from the perspective of an advanced J
>> programmer?
>>
>> On -Apr28-2009, at -Apr28-20091:09 PM, Sherlock, Ric wrote:
>>
>>>> From: bob therriault
>>>>
>>>> My questions.
>>>>
>>>> 1. Any comments on my approach and style are welcome. I seek
>>>> guidance.
>>>
>>> Here is a slightly different take on your script. The biggest
>>> differences:
>>>
>>> * the display verb takes a right argument
>>> * It uses the Unicode box drawing chars if specified by the user's
>>> session.
>>>   wd 'set tdisp *', ,LF,~"1 u...@ucpboxdraw_jijs_"1 ":STYLE <'ZZZ'
>>> * It simplifies the event handlers for the radiobuttons by reading
>>> which one is selected in the update verb.
>>>
>>> coclass 'rgtVisual'
>>> NB. ---------------------------------------------------------
>>> NB. This script creates a form that takes tacit sentences
>>> NB. entered by the user in a text box and displays the
>>> NB. selected format in a listbox.
>>> NB. ---------------------------------------------------------
>>>
>>> style=: 5!:   NB. adverb
>>>
>>> DISPLAY=: 0 : 0
>>> pc display dialog;
>>> xywh 291 167 44 12;cc cancel button leftmove topmove rightmove
>>> bottommove;cn "Close";
>>> xywh 9 156 216 22;cc box edit topmove rightmove bottommove;
>>> xywh 248 24 60 11;cc rbFormatBox radiobutton leftmove rightmove;cn
>>> "Box Format";
>>> xywh 248 40 60 11;cc rbFormatLinear radiobutton leftmove rightmove
>>> group;cn "Linear Format";
>>> xywh 248 55 60 11;cc rbFormatTree radiobutton leftmove rightmove
>>> group;cn "Tree Format";
>>> xywh 248 72 60 11;cc rbFormatParen radiobutton leftmove rightmove
>>> group;cn "Paren Format";
>>> xywh 240 11 95 80;cc format groupbox leftmove rightmove;cn "Display
>>> Style";
>>> xywh 0 0 225 150;cc tdisp listbox ws_hscroll ws_vscroll
>>> lbs_multiplesel rightmove bottommove;
>>> pas 6 6;pcenter;
>>> rem form end;
>>> )
>>>
>>> NB. ---------------------------------------------------------
>>> NB. form creation
>>> NB. ---------------------------------------------------------
>>>
>>> NB. box=: 'NB. Function here'
>>>
>>> display_run=: 3 : 0
>>> wd DISPLAY
>>> wd 'set box "',y,'";'
>>> wd 'setfont box ',FIXFONT,';setfocus box;' NB. FIXFONT is specified
>>> in user session
>>> wd 'setfont tdisp ',FIXFONT,'; setenable tdisp 1;'
>>> wd 'set rbFormatBox 1;'
>>> RBFORMAT=: 'rbFormat'&,&.> ;:'Box Tree Linear Paren'
>>> update y
>>> wd 'pshow;'
>>> )
>>>
>>> display_close=: 3 : 0
>>>  wd'pclose'
>>> )
>>>
>>> NB. ---------------------------------------------------------
>>> NB.  repaint if the form already exists, otherwise create it
>>> NB. ---------------------------------------------------------
>>>
>>> display=: 3 : 0
>>> try.
>>>   wd 'psel display;'
>>>   if. 0=#y do. y=. box end.
>>>   wd 'set box "',y,'";'
>>>   update y
>>> catch.
>>>   display_run y          NB. create form
>>> end.
>>> )
>>>
>>> NB. ---------------------------------------------------------
>>> NB. repaint tdisp according to STYLE of box contents
>>> NB. ---------------------------------------------------------
>>>
>>> update=: 3 : 0
>>> try.
>>>  sidx=. {. 2 4 5 6 2 {~ I. 99".> RBFORMAT wdget wdq
>>>  ".'ZZZ=. ' , y NB. ZZZ is a global dummy that holds the tacit entry
>>>  wd 'set tdisp *', ,LF,~"1 u...@ucpboxdraw_jijs_"1 ": sidx style
>>> <'ZZZ'
>>>  catch.
>>>  wd 'set tdisp *',13!:12 ''
>>> end.
>>> )
>>>
>>> NB. ---------------------------------------------------------
>>> NB. event controls for objects on the text form
>>> NB. ---------------------------------------------------------
>>>
>>>
>>> display_cancel_button=: display_close
>>>
>>> display_box_button=: display
>>> display_rbFormatLinear_button=: display
>>> display_rbFormatBox_button=: display
>>> display_rbFormatTree_button=: display
>>> display_rbFormatParen_button=: display
>>>
>>> display_z_=: display_rgtVisual_
>>>
>>> NB. display ''
>>>
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/ 
>> forums.htm
>>
>
>
>
> -- 
> (B=) <-----my sig
> Brian Schott
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to