Hi everybody, First, my name is Bob Therriault and I have been following/playing with J for a number of years (this does not mean that my understanding is advanced, as I am constantly reminded as I read the posts on this forum). My background is communications (specifically television production), computing science (BSc, Simon Fraser University '85) and distance education (MA Learning and Technology, Royal Roads University, '08). That should be enough background for now.
Recently I posted the following script to the chat forum, as my previous post to this forum was unsuccessful ( resubscribing seemed to fix this). It is meant to allow a tacit expression to be viewed in a number of formats. It is not complex, but did allow me to stretch my abilities with the form editor (my first version displayed in an isigraph, until I realized that listboxes would automatically include trackbars for oversized displays). My questions. 1. Any comments on my approach and style are welcome. I seek guidance. 2. I would like to allow a flexible resizing to this form (including repositioning of of the form objects), but I am looking for which event is triggered by a resize. The gl2 lab shows what can be done with isigraph, but not so much for the resizing of the form itself. Any input is appreciated. 3. Is there a value to tools like this for J users (especially beginners)? I am thinking of working a more interactive version that could allow the user to examine the intermediate results of the different entities. (Apple's conduit approach to Quartz Composer http://en.wikipedia.org/wiki/Quartz_Composer mixed with Roger Stokes EVM script is the basis of my vision). Cheers, bob cocurrent 'rgtVisual' require'gl2' NB. load gl2 definitions in jgl2 locale coinsert'jgl2' NB. allow use of gl2... without _jgl2_ 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. --------------------------------------------------------- DISPLAY=: 0 : 0 pc display dialog; xywh 386 330 44 12;cc cancel button;cn "Close"; xywh 9 309 317 22;cc box edit; xywh 343 24 60 11;cc boxFormat radiobutton;cn "Box Format"; xywh 344 40 60 11;cc mathFormat radiobutton group;cn "Linear Format"; xywh 344 55 60 11;cc treeFormat radiobutton group;cn "Tree Format"; xywh 344 72 60 11;cc parenFormat radiobutton group;cn "Parenthesis Format"; xywh 333 11 95 80;cc format groupbox;cn "Display Style"; xywh 0 0 326 299;cc tdisp listbox ws_hscroll ws_vscroll lbs_multiplesel; pas 6 6; rem form end; ) NB. --------------------------------------------------------- NB. form creation NB. --------------------------------------------------------- display_run=: 3 : 0 wd DISPLAY GHANDLE=: wd'qhwndc tdisp' NB. gsel arg to select gl target wd 'setfont box "courier" 12;setfocus box;set box "+/%#";' wd 'setfont tdisp "courier" 12; setenable tdisp 1;' wd 'set boxFormat 1;' STYLE=: 5!:2 COLOUR=: 0 0 0 box=: '+/%#' NB. set default display directly update '' wd 'pshow;' ) NB. --------------------------------------------------------- NB. repaint if the form already exists, otherwise create it NB. --------------------------------------------------------- display=: 3 : 0 try. wd 'psel display;' update '' catch. display_run'' NB. create form end. ) NB. --------------------------------------------------------- NB. repaint tdisp according to STYLE of box contents NB. --------------------------------------------------------- update=: 3 : 0 try. ".'ZZZ=: ' , box NB. ZZZ is a global dummy that holds the tacit entry wd 'set tdisp *',;(<"1 ": STYLE < 'ZZZ'), each LF catch. wd 'set tdisp *', 'Not a valid tacit expression' end. ) NB. --------------------------------------------------------- NB. event controls for objects on the text form NB. --------------------------------------------------------- display_close=: 3 : 0 wd'pclose' ) display_cancel_button=: 3 : 0 display_close '' ) display_box_button=: 3 : 0 display '' ) display_mathFormat_button=: 3 : 0 STYLE=: 5!:5 display '' ) display_boxFormat_button=: 3 : 0 STYLE=: 5!:2 display '' ) display_treeFormat_button=: 3 : 0 STYLE=: 5!:4 display '' ) display_parenFormat_button=: 3 : 0 STYLE=: 5!:6 display '' ) display '' ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm