Guides/Window Driver/Command Reference
wd takes a string right argument and returns a string result.
A wd argument is 0 or more statements delimited by semicolons. See wd command syntax for more information.
A wd error is reported as a J domain error. Use the command wd 'qer' to see the error message text and index of the erroneous argument for the last wd error.
The first letters of a command usually indicate a category: mb (message box and common dialogs), menu, p (parent), q (queries for other than properties), set (setting properties), get (querying properties).
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.
A color is 3 (or 4) parameters giving RGB (or RGBA) 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.
- The syntax of wd commands
- Forms: create, populate, and display
- Common Dialog Boxes for communicating with the user
- wd commands for the J session
- Event Handling
activity locale ; (Android only) start a new Android activity. The parameter is the J locale which contains callback verbs for various stages of an Android activity lifecycle. The following callbacks are supported,
Only the onStart is mandatory, and any pc command must be executed inside the onStart callback verb.
coclass 'loc' onStart=: 3 : 0 wd 'pc foo' .... ) wd 'activity loc'
An activity can have only one window created by pc command. It is an error to call pc outside onStart callback verb or to call pc twice within the same activity. Parent forms are not needed for either activity or pc command.
bin parameters... ; set Qt layout. The parameters are a list of characters from the set "hvgpsz", meaning horizontal, vertical, grid, spacing, stretch and end layout, which are processed in order (left to right). The "hvs" commands can optionally be followed by an integer stretch factor, default 0 (no stretch). Any spaces are ignored.
Layouts are in a stack. If none is given at the start, then a "bin v" is done automatically. At the end, a wd 'pshow' clears any entries remaining on the stack.
bin h 1 horizontal layout with stretch 1 bin h1 v v 2 h1 followed by v followed by v2 bin s 1 add no-name widget with stretch 1 bin g start a new grid layout
See Guides/Window Driver/Layout for further details.
cc id class [style...] ; create child. id must be a valid J name containing no underscores. Available classes include button, checkbox, combobox, combolist, dateedit, dial, dspinbox, edit, edith, editm, image, isigraph, listbox, multimedia, opengl, progressbar, quickwidget, radiobutton, scrollarea, scrollbar, slider, spinbox, static, statusbar, tab, table, timeedit, toolbar and webview. See Guides/Window Driver/ChildClasses for further details.
clipcopy text ; put text on the clipboard
clipcopyx format filename ; format must be image. Put image 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
clippastex format filename ; format must be image. Put image data from clipboard to file.
cmd id command ; execute command on child id; applicable to edith and editm widgets, see Guides/Window Driver/ChildClasses for further details.
cn name ; set child name after a cc command (otherwise set caption is preferred)
defprint [orient|margin|printer|font] parameters ; sets the default printer or the orientation, margins or default font for the default printer. Parameter for orient is either "landscape" or "portrait". For margin, 1, 2, or 4 real values must be provided to set the margin in mm for all sides, top/bottom and left/right, or left, top, right, and bottom, respectively. For printer, the parameter is the printer name (from wd'qprinters'), generally preceded by a *. For font, it is a fontspec. Note that in editm or edith controls, the font used in the control, often set by a style, will be printed.
fontdef fontspec ; default font used when a form or a child is created.
- reset to application default if fontspec is elided
fontfile file ; (Android only) add the file to an application's font database. Fonts contained inside the file can then be used in subsequent wd font commands.
get id attribute [parameters] ; get attribute of child. See Guides/Window Driver/ChildClasses for further details.
- gets data from listbox and table widgets. See Guides/Window Driver/ChildClasses for further details.
getp attribute [parameters] ; get attribute of parent. See Guides/Window Driver/Parent for further details. (added in J8.04)
grid cmd ...; grid layout commands
- grid cell row col [rowspan colspan] [alignment] - cell at row,column with optional spans and/or alignment
- grid colstretch col stretch [...] - set column stretch. col and stretch can appear multiple times. Similarly for the following commands.
- grid colwidth col width [...] - set column width
- grid rowheight row height [...] - set row height
- grid rowstretch row stretch [...] - set row stretch
- grid [shape|size] [nrow] ncol - grid with cells in ravelled order. If nrow is elided, number of rows is unspecified.
groupbox [title] ; set groupbox with an optional title
groupboxend ; end a groupbox
ide [hide|show] ; hide or show ide
line ; or lineh ; adds a horizontal rule to the layout.
linev ; adds a vertical rule to the layout.
maxwh w h ; set maximum size in pixels for the succeeding cc command. (added in J804)
mb ... Common dialog boxes for opening files, giving informational messages, & choosing fonts, colors, & printers. Described in Guides/Window Driver/MessageBox.
menu id text ; add menu item.
menupop text [hotkey] ; add popup menu item with optional hotkey (e.g., "Ctrl+P").
menupopz ; ends popup menu and drops down a level
menusep ; separator line in a popup menu
minwh w h ; set minimum size in pixels for the succeeding cc command.
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.
openj filename ; If the file is not open in an edit window, a tab is created for it. Then, the tab for the file is activated in the current edit window.
If the file is active in the inactive edit window, it is moved to the active one.
pactive ; Make the selected parent window active
pas left top [right bottom] ; parent size adjusted to provide left and top margins beyond children. If right and bottom are elided, they will be equal to left and top.
pc id [style...] ; parent create. Styles are: minbutton, maxbutton, closebutton, nosize, dialog, ptop, owner, escclose and closeok. The appearance of the form and the effects of the various styles depend on the operating system. See the script ide/demo/pstyles.ijs. To set attributes for the parent, use setp.
For Android, see also activity.
pcenter ; center parent on screen
pclose ; close parent. If no parent selected, nothing is done and there is no error.
picon iconfile ; sets the window icon to iconfile. The data within iconfile may be in bmp, gif, jpg, png, or svg format.
pmove x y w h ; move and size parent in pixels. If either x or y is _1, it will not move. If either w or h is _1, it will not resize.
pmoves [x y w h] ; (from Qt IDE 1.7.2) this enables save/restore of the form position and size. The optional argument is the default position and size as for pmove. When the form is closed, the position and size are saved to ~config/winpos.dat using the form id as a key. When the form is reopened, any saved settings will be used.
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.
pshow [fullscreen|maximized|minimized|normal|hide] ; shows the currently selected window.
pstylesheet styles ; sets the stylesheet for the currently selected window to styles.
ptimer i ; set form interval timer to i milliseconds. This has the same behavior as timer, but is signaled as a form event, using the formname of the selected parent at the time ptimer i is executed. When the time has elapsed, the sentence formname_timer_formlocale_ '' is executed. The parent is not automatically psel'd before the sentence is executed.
ptop  ; raises the currently selected window to the top level of the display. The window will also try keep to staying on top if 1.
q ; return event data.
qchildxywh id; return child position and size in pixels.
Note for isidraw and isigraph controls: wd qchildxywh returns the position and size allocated on the screen. The layout system may allocate more screen area than the drawable area of the control. To find the drawable area, use the glqwh command.
qd ; returns form data.
qer ; return last error information
qform ; returns form x y w h values in pixels.
qhwndc id; return HWND (handle) of child
qhwndp ; return HWND (handle) of current parent
qopenglmod ; returns 0 if desktop OpenGL driver, 1 if OpenGL ES 2 or newer. (added in J804)
qosver ; returns the version number of the operating system; applies only to Windows, OSX and Android. (Android support added in J804)
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 mb print or File|Print Setup.
qpx ; extended information about all forms. wdforms returns the qpx result as a matrix where each row has the following: id, qhwndp, locale.
qscreen ; screen information.
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 (ppi) aspecty relative height of a pixel (ppi) aspectxy relative diagonal width of a pixel
qtstate parameters; returns Qt status for parameters (added in J802). Use wd 'qtstate all' to see all parameters.
quickview1 id url [0|1]; (Qt 4.8 only) create a QtQuick 1 top level window for displaying QML component url (added in J802). The id is ignored in the current implementation and only one quickview1 is supported in an application. The optional resize mode parameter  or  (default) determines whether the view should resize the window contents. See Guides/Window Driver/QtQuick for further details.
quickview2 id url [0|1] [version version]; (Qt 5.3 only) create a QtQuick 2 top level window for displaying QML component url (added in J802). The id is ignored in the current implementation and only one quickview2 is supported in an application. The optional resize mode parameter  or  (default) determines whether the view should resize the window contents. The version parameter is a decimal number for setting the desired major and minor OpenGL versions. See Guides/Window Driver/QtQuick for further details.
qwd ; returns 'jqt'.
qverbose ; returns verbosity level. (added in J804)
rem text ; remark.
reset ; close all windows.
set child attribute values ; set child attribute with values. See Guides/Window Driver/ChildClasses for further details.
setp attribute values ; set parent attribute with values. See Guides/Window Driver/Parent for further details.(added in J804)
sm ... the commands sm ... apply to the J session windows, see Guides/Window Driver/Session Manager
splith|splitv [f1 f2 [s1 s2]] ; start horizontal or vertical splitter. Optional parameters are 2 or 4 numbers f1 f2 s1 s2. f1 f2 are stretch factors; s1 s2 are initial sizes. Subsequent commands populate the panels.
splitsep ; separates splitter panels.
splitend ; finishes splitter.
timer i ; set session interval timer to i milliseconds. The sentence sys_timer_z_ '' is executed 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. See also ptimer.
- To run the timer code in a locale other than z, define sys_timer_z_ =: sys_timer_localename_.
ws cmd parameters ; websocket interface. See Guides/Window Driver/Websocket for further details.
verbose n ; sets debug messages verbosity level. (added in J804)
- 0 : silent (default)
- 1 : print offending wd commands on Term when error occurred
- 2 : print all wd commands on Term
- 3 : print all wd commands on console
version ; returns jqt version.