>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User

wd commands 11!0

wd takes a string right argument and returns a string result. A wd argument is 0 or more statements delimited by semicolons. A statement is a command followed by 0 or more parameters. Commands and parameters are separated by one or more whitespace characters from the set: space, carriage return, line feed, and tab. Simple parameters start with an alphanumeric, -, or _, and run to a; or whitespace. A * starts a parameter at the next character, and runs to the end of the array. Delimited parameters start with " or 127{a. (DEL) and run to the matching delimiter. Some commands are not supported in some environments.

A wd error is a J domain error. Command qer returns the error message text and wd argument index for the last error.

The first letters of a command usually indicate a category: mb (message box and common dialogs), menu, ole, p (parent), q (queries), set (setting properties), and sm (session manager).

A parameter can be an id, style, number, or text. An id identifies a parent, child, menu item, or other object. A style is a keyword, usually with a prefix. For example, bs_autoradiobutton is a button style.

A color is 3 parameters giving RGB values in the range 0 to 255. For example, 0 0 0 is black, 255 255 255 is white, and 255 0 0 is red.

A bool is 0 or 1 and is 1 if elided.

wd Commands

beep [i] ; beep (parameter is ignored)

cc id class [style...] ; create child

clipcopy text ; put text on the clipboard

clipcopyx format filename ; (jwdw only) format must be enhmetafile. Put enhanced metafile data from file to clipboard.

clippaste [type] ; result is text or files from the clipboard
        0 - same as elided, clipboard text or empty if no text
        1 - clipboard text or command failed if none
        2 - clipboard files (drag and drop) or command failed if none

clippastex format filename ; (jwdw only) format must be enhmetafile. Put enhanced metafile data from clipboard to file.

cn name ; set child name after a cc command (otherwise setcaption is preferred)

creategroup id ; causes parent commands to be ignored so that, when a form definition is run, the child controls created are in the current form. The id is a control in the current form, usually a tab control, and child creates are offset from that control. Controls created under creategroup are hidden and are part of a group with the id from their ignored pc command. The setshow command with a group id hides or shows the controls in a group. A form definition loaded under creategroup is a normal form definition that can be designed and tested with the form editor. It is loaded by a main form with a form_run that is bracketed by creategroup commands. The first creategroup gives the id of a control in the main form and the final creategroup command has no parameter and ends the group.

creategroup ; ends the group started by a previous creategroup command

fontdef fontspec; default font used when a child is created.

mb title text [style...] ; messagebox with styles from set (mb_arbortretryignore, mb_defbutton2, mb_defbutton3, mb_iconasterisk, mb_iconexclamation, mb_iconhand, mb_iconinformation, mb_iconquestion, mb_iconstop, mb_ok, mb_okcancel, mb_retrycancel, mb_yesno, mb_yesnocancel)

mbcolor [colors] ; choose color common dialog box. Result is chosen color and 16 custom colors. Colors are 3 integers giving RGB values. Optional argument sets initial chosen color and 16 custom colors (51 integer values in range 0 to 255).

mbfont [fontspec] ; choose font common dialog. Start with last chosen and set new one if OK. Result is a fontspec.

mbopen title directory filename filterpairs [style...] ; open file common dialog returns fully qualified file name selected by user. Filterpairs are delimited by |. Styles are from the set (ofn_createprompt, ofn_filemustexist, ofn_nochangedir, ofn_overwriteprompt, ofn_pathmustexist).

wd 'mbopen'
wd 'mbopen  mytitle  ""  ""  "Write(*.wri)|*.wri|Word(*.doc)|*.doc" ofn_filemustexist'


In Jwdw a filter can have multiple file types. For example:

"Text(*.txt);Html(*.htm)|*.txt;*.htm|(Word(*.doc)|*.doc"

mbprinter [pd_printsetup] ; The parameter selects the page setup dialog instead of the print dialog. The result is '' if the user pressed CANCEL. If the user pressed OK, the result is the name of the selected printer followed by LF delimited values. Currently the only value after the name is the print-to-file value from the print dialog.

mbsave title directory filename filterpairs [style...] ; save file common dialog returns fully qualified file name (see mbopen).

menu id text ; add menu item

menupop text; add popup menu item

menupopz ; ends popup menu and drops down a level

menusep ; separator line in a popup menu

msgs ; allows processing of messages and discards those that would cause wdhandler events. Do msgs periodically in a long-running sentence to allow messages like repaints and status updates to be processed. See  Message Pump and Long-Running Sentences for more information.

ole commands...

pactive ; SetActiveWindow for selected parent

pas i j ; parent size adjusted to provide i and j margins beyond children. The nopas style ignores a child in this calculation (used in Form Editor).

pc id [style...] ; parent create. Styles are: nomenu, nomin, nomax, nosize, dialog, owner, and closeok.

pcenter ; center parent on screen

pclose ; close parent. If no parent selected, nothing is done and there is no error.

pcolor R G B; set parent background color. See setcolor command.

pgroup groupname; set parent groupname. Parents are created with a default groupname of ''. The ijx window has a groupname of 'ijx' and an ijs window has a groupname of 'ijs'. A groupname can be used as an argument to the reset and qp commands.

picon filename n ; (win32) set form icon with icon n from file (exe, dll, or ico file)

wd'picon "',(jsystempath 'system\examples\data\jy.ico'),'" 0'

pmove x y w h ; move and size parent in logical units

pmovex x y w h ; move and size parent in pixels

pn text ; name for parent window caption

psel id ; select parent id to be target for subsequent commands

psel n ; select parent with qhwnp of n for subsequent command

psel ; clear parent and child selection

pshow [style] ; style is from the set: sw_hide, sw_minimize, sw_restore, sw_show, sw_showmaximized, sw_showminimized, sw_showminnoactive, sw_showna, sw_shownoactivate, sw_shownormal. sw_shownormal is the default.

ptop [bool]; set 1 so that window stays on top of other windows. No error on PocketPC or Jwdp (portable Java version), but has no effect.

q ; return event data

qchildxywh id; return child position and size in units

qchildxywhx id; return child position and size in pixels

qcolor color ; return RGB for system colors defined in system\packages\color\wdcolor.ijs

qd ; return data for form. Similar to q result.

qer ; return last error information

qformx ; returns form x y w h values in pixels.

qhinst ; (win32) return HINSTANCE of application

qhwndc id; return HWND (handle) of child

qhwndp ; return HWND (handle) of current parent

qhwndx ; (win32) return HWND (handle) of application

qiox ; return 1 if jee if  (console program that links emacs to Jwd)

qkeystate keys ; (win32) returns 0 or 1 (pressed) for each key in keys. The values in keys are virtual key values as defined in packages\graphics\vkeys.ijs.

The portable way to work with shift type info in an event is to use the sysmodifiers event data. The sysmodifers value is: 2#.ALT,META,CTRL,SHIFT

qm ; return system metrics:
        screen width, screen height,
        x logical unit, y logical unit,
        cxborder, cyborder,
        cxfixedframe, cyfixedframe,
        cxframe, cyframe,
        cycaption, cymenu,
        desktop x, desktop y,
        desktop w, desktop h
        More elements may be added.

qp [groupname] ; return parent ids. With no parameter it reports all windows with the default groupname of ''. With a groupname parameter it reports all windows with that groupname.

qprinters ; returns LF delimited list of printers. The first entry is the session default printer. The second entry is the system default printer. The remaining entries are a list of all printers. The session default printer starts out as the system default printer and is changed by mbprinter or File|Print Setup.

qpx ; extended information about all forms. wdforms_j_ returns the qpx result as a matrix where each row has the following: id, qhwndp, locale, group, active index, caption. The group is set by pgroup and is '' by default. The higher the active index the more recently the form had focus.    

qrtf id; (win32) return RTF data from richedit control

qscreen ; screen information
horzsizewidth in millimeters
vertsizeheight in millimeters
horzreswidth in pixels
Vertresheight in raster lines (pixels)
logpixelsxhorizontal pixels per logical inch
logpixelsyvertical pixels per logical inch
bitspixelnumber of color bits per pixel.
planesnumber of color planes
numcolorsnumber of entries in the device's color table (_1 if > 8)
aspectxrelative width of a pixel
aspectyrelative height of a pixel
aspectxydiagonal width of a pixel
qwd ; returns 'jjava' for Jwdp and 'jwin32' for Jwdw

rem text ; remark

reset [groupname] ; close windows. With no parameter it closes all windows with the default groupname of ''. With a groupname parameter it closes only windows that have that groupname (as set by the pgroup command).

sbar n; create status bar with n panes

sbarset id width text; set id, width, and text of the next statusbar pane. A width of -1 leaves the width unchanged. A set command sets the text of the pane.

sbarshow [bool]; show (1) or hide statusbar

security [bool]; (win32) 1 sets java sandbox (disables commands that can 'cause damage')

set id [parameters...] ; set object property
checkbox, radiobutton - check (1 or elided) or uncheck (0)

combobox - similar to listbox

edit, editm - set text.

isipicture - set filename of picture source. dib or bmp (device independent bitmap), wmf (windows metafile), or ico (icon) file to display.

listbox - clear contents and add items. A parameter can contain LF delimited items. Ownerdrawfixed listbox items are picture file names.
   wd 'set  listbox  red  green  blue'
   wd 'set  listbox  red  green  blue  "pink',LF,'orange"'


menu - check (1 or elided) or uncheck (0). If menu and toolbar button have same id, both are set.

progressbar - set value in range 0 to 100

richedit, richeditm - set RTF text

scrollbar - set min/position/max/pagesize values or just position
   wd'set scrollbar 0 60 100 10'
   wd'set scrollbar 75'


static - set text

statusbar - set pane text

tab - add a tab for each parameterwd'set tab Jan Feb Mar Apr'

toolbar - check (1 or elided) or uncheck (0). If menu and toolbar button have same id, both are set.

trackbar - similar to scrollbar but has linesize in addition to pagesizewd'set trackbar 0 60 100 10 2'
setbkgnd id color ; set background RGB color of richedit or richeditm control

setcaption id text ; set control caption. If control is ownerdraw button, text is picture filename.

setcolor id textR G B textbkgndR G B bkgndR G B ; set control colors. You can set form and control (text, text background, and background) colors. The setcolor command can override the gray readonly edit boxes. The setcolor command has no effect on push buttons or the dropdown listbox of a combobox (unfortunate Window facts). The textbkgndR G B values are ignored in Java and generally look bad in Windows if different from the bkgndR G B values. For example:

abc_run=: 3 : 0
wd ABC
NB. initialize form here
wd 'pcolor 0 0 255'
wd 'setcolor cceditm 255 0 0 0 0 255 0 0 255'
wd 'pshow;'
)


setcolwidth id width ; (win32) set multicolumn listbox column width

setdelete id n ; delete tab item n

setedit id x ; parameter is z x c v or y and it performs the command undo, cut, copy, paste, or redo

setenable id [bool] ; enable (1) or disable. Applies to menu items, toolbar buttons, and controls.

setfocus id ; set focus on control

setfont id fontspec; set font for control

setinsert id n text ; insert tab item at position n

setinvalid id ; Requests host to call paint event on the control. If the control is an isigraph the memory pixel buffer is cleared.

setlimit id n ; (win32) limit length of user typed text in edit, editm, richedit, richeditm, combodrop, and combobox controls.

setlocale id locale ; sets a locale name for a control so that events run wdhandler in the control locale instead of the form locale. This allows defining control event handlers in the control locale (usually a numbered control object locale) rather than in the parent locale (usually a numbered form object locale).

setlocale works for all controls but is probably most useful with control objects based on an isigraph.

syslocalec in wdq is the child locale and syslocalep is the parent locale.

A handler in a control object locale can use syslocalep to access the forms object for services and data. For example, to call a routine in the parent to inform it of changes in the control (perhaps to update another control).

setmodifed id [bool] ; sets modified for ijs/ijx in Windows. Noop in Java.

setpclip id [bool] ; Avoids clipping the controls area out before painting the parent. This is used in the Form Editor. Noop in Java.

setreadonly id [bool] ; set readonly (1) for edit, editm, richedit, and richeditm

setreplace id newtext ; replace selected text with newtext in edit, editm, richedit, and richeditm control

setreplace id n newtext ; replace tab item n text with newtext

setscroll id n ; scroll n to be first visible line in editm and richeditm control

setselect id [parameters...] ; set selection
edit, editm, richedit, richeditm - parameters are [ start end [noscroll ] ]. Selects text from start to end. If start and end are elided, then all text is selected. If noscroll is elided or 1, then the selection is not scrolled into view. If noscroll is 0, then the selection is scrolled into view

combobox, listbox - -number of item to select. -1 clears selection.

trackbar - parameters are start and end of range to mark as selected
setshow id [bool] ; show (1) or hide. If it is a group id (the id of the pc command ignored by a creategroup), then all controls in the group are affected. Controls explicitly hidden are not affected by a group show.

settabstops id [ n [ n [ n...] ] ] ; sets tab stops in editm and listbox controls. Values are in dialog units.

setupdate id ; Update window immediately. Noop in Java.

setxywh id x y w h ; set child position and size in units

setxywhx id x y w h ; set child position and size in pixels

smcolor n R G B; set code editor color. No effect in Jwdp.

sminputlog ; return input log

smkeywords n keywords ; code editor keywords (for color n). No effect in Jwdp.

smsetlog ; set input log

tbar filename [count style] ; set filename of bmp file (bmp or gif for jwdp) for toolbar. If style is tbstyle_flat then count is the number of toolbar positions (buttons and seperators). The count and tbstyle_flat parameters are ignored in Jwdp. The file contains images that are 16 pixels wide by 15 pixels high.

tbarset id index image; set id for a toolbar button. index is the position in the displayed toolbar and image is the index of the button bitmap to use from the toolbar bitmap.

tbarshow [bool]; show (1) or hide toolbar

timer i ; set interval timer to i milliseconds. Event systimer occurs when time has elapsed. The timer keeps triggering events until the timer is turned off. An argument of 0 turns the timer off. The systimer event may be delayed if J is busy, and it is possible for several delayed events to be reported as a single event.

tnomsgs [bool] ; (win32) 1 disables GUI msg processing (such as mouse events and ctrl-break) while the J engine is running and 0 enables.

wait ; used to create modal dialogs similar to the mb... commands. Creates a new message pump that processes messages and allows the program to capture the result and continue execution. The wait command disables events except for the currently select form, and waits for an event. The event information is given by  wd'q'  . See definition of wdselect for complete example of how to use wait. See  Message Pump and Long-Running Sentences for more information.

winexec commandline [style]; Execute commandline. style is same as for pshow.
   wd ' winexec  "write.exe  text.wri"  sw_showmaximized;'

Lines run in a Command Prompt window are processed by cmd.exe and it is cmd that handles things such as > redirection of output. If you want cmd processing then you need to run cmd with a /C parameter to run the rest of the line as in Command Prompt. Do cmd /? to see documentation. For example:
   wd ' winexec "cmd /C netstat > \file.dat" sw_hide;'

xywh x y w h ; sets rectangle

ole commands (win32)

oledlg id ; run property dialog. State can be saved with the olesave command.

oleenable id eventname [bool] ; enable/disable event. You must enable an event in order to trigger an event in J.

oleget id objectname property ; return property value. Objectname is base, temp, or a name set with oleid. If the result is an object, it is set as the temp object. This allows a series of wd commands that use the temp object to get the next object.

olegetlic progid ; returns licence information. OCX controls distributed with a J application can be distributed in a runtime version that requires license information when they are created. On a system with the design time OCX installed, use olegetlic to get the license The progid is the same id used in the cc command (without the ocx: prefix). To create the OCX on a system with a runtime OCX, use olesetlic to set the license. The following example uses the FarPoint spreadsheet control.

   fpkey =: wd'olegetlic FPSpread.Spread.2'
   fpkey
67 0 111 0 112 0 121 0 114 0 105 0 103 0 104 0 116 0 32 0 ...
   (".fpkey) { a.   NB. 2 byte unicode is often readable
Copyright ...

   NB. in a distributed application set key before cc
   wd'olesetlic FPSpread.Spread.2 ',fpkey
   wd'cc ss ocx: FPSpread.Spread.2'

oleid ; give a temp object a name to make it permanent

oleinfo id ; return information about events, methods, properties, and constants

oleload id filename ; initialize properties from a file created by olesave. An oleload should only be done once before it is shown.

olemethod id objectname method parameters....; run a method. , is an elided parameter. A wd parameter of , is the same as "", except it is treated as an elided parameter where appropriate.Some methods distinguish between a numeric parameter and a string. A simple (not delimited) string that is an integer is treated as an integer. If you want 23 to be treated as a string, use "23". If the result is an object, it is set as the temp object.

        An object parameter is indicated by a simple parameter of the form:object:formid.childid.objectname

        A picture object parameter is indicated by a simple parameter of the form:picture:filename

olemethodx ;

oleocx ;

olerelease ;

olesave id filename ; save properties in a file that can be used to initialize a control after it is created

oleset id objectname property value ; set property value

olesetlic ; see olegetlic

Incompatible changes

197{a. is no longer supported as a parameter delimiter. Event data no longer includes sysinfo. Many commands have been decommitted.

>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User