wd commands

>> << Ndx Usr Pri 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 255{a. (EAV) 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: dde, mb (message box and common dialogs), menu, ole, p (parent), q (queries), set (setting properties), sm (session manager), and vbx.
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
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
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
dde commands...
fontdef fontspec; default font used when a child is created.
javalaf ; return list of supported Look and Feel settings
javasetlaf laf ; set Look and Feel from one of the lafs listed by the javalaf command. Existing windows are not repainted with the new laf. The Windows laf is only available on Windows.
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 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. This sets the session default printer setup ithat is used by glzcreate with no argument.
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
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 resize parent. Values are in logical units and are relative to the top left corner of the screen. Value of -1 inherits current value.
pmovex x y w h ; move and size form 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 Jwdp (portable Java version), but has no effect.
q ; return event data
qbreak ; (win32) returns count of menu/button/and toolbar commands that have been ignored because J was busy. This value can be polled in a loop with a long execution time to see if the user is getting impatient.
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 ; (win32) returns an 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 (see glqprinter)

> horzsize | width in millimeters
> vertsize | height in millimeters
> horzres | width in pixels
> Vertres | height in raster lines (pixels)
> logpixelsx | horizontal pixels per logical inch
> logpixelsy | vertical pixels per logical inch
> bitspixel | number of color bits per pixel.
> planes | number of color planes
> numcolors | number of entries in the device's color table (_1 if > 8)
> aspectx | relative width of a pixel
> aspecty | relative height of a pixel
> aspectxy | diagonal 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 ; (win32) 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 ; (win32) InvalidateRect
setlimit id n ; (win32) limit length of user typed text in edit, editm, richedit, richeditm, combodrop, and combobox controls.
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 ; (win32) the normal message loop executes a handler in immediate execution when an event occurs. This is overkill for getting input from a simple form, and the way mb works is simpler: the message box is displayed, other events are disabled until it is closed, and the result is the wd result. The wait command allows a form to be used in a similar way. The wait command shows the form, disables events except for that form, and waits for an event. The event information is given by wd'q'. While a wait form is active events in other forms, DDE events, and timer events are disabled. They are enabled when the wait form is closed.
winexec text [style]; Execute program. style is same as for pshow.
wd ' winexec "write.exe text.wri" sw_showmaximized;'
xywh x y w h ; sets rectangle. -1 value inherits the previous value.

# dde commands (win32)

ddeadvise t i d ; send data to client in an advise loop. Client will get ddeadvise event.
ddecons ; return s|t active conversations
ddedis [s [t]] ; discontinue conversations

> wd 'ddedis;' conversations with all servers
> wd 'ddedis s;' conversations with servers
> wd 'ddedis s t;' conversation with server s on topic t

ddeex s t d ; data d is sent to server s for topic t to execute
ddename id ; set dde service name (can be done only once). Command line /ddename= can also set dde service name.
ddepoke s t i d ; send data to S|T!I
ddereq s t i ; data for item i is requested from S|T
ddereqd d ; send data in response to ddereq event (must be done immediately after ddereq event)
ddestart s t i ; advise loop requested for S|T!I. New data signals ddeadvise event.
ddestop s t i ; stop advise loop on S|T!I

# 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 ; returns licence information
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 ; set the licence information for a runtime OCX

# 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 Phr Dic Rel Voc !: wd Help User