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

Reply via email to