Guides/Window Driver/Parent

From J Wiki
Jump to navigation Jump to search


wd implements a parent form based on the QWidget class. A top level window is creating using the pc (parent create) command with the format

wd'pc id styles '

where id is the identifier for the window, and styles is an optional list of styles for the window. Many, though not all, of the underlying Qt widget's properties are exposed by styles specified in the pc command or through wd setp commands:


The optional styles are:

  • escclose: pressing Esc closes the form
  • closeok: form close button closes the form with no event
  • dialog: display window decorations as a dialog
  • popup: a popup window with no window decorations
  • minbutton: show form minimize button
  • maxbutton: show form maximize button
  • closebutton: show form close button
  • ptop: the form stays on top
  • nosize: the form may not be resized
  • owner: the form is modal to a single window hierarchy

Styles dialog and popup are alternatives. Others are independent.

Setp commands

wd'setp attribute data '

The above setp command modifies the 'attribute' using data.

For the setp commands below, optional or alternative parameters are enclosed within brackets.

enable: wd'setp enable [0|1]'; disables [0] or enables [1] a parent. The parameter 1 may be elided.

font: wd'setp font fontspec '; sets the font for the parent to fontspec, for example, Arial 10 bold. Note that fonts set with stylesheet take precedence.

invalid: wd'setp invalid'; updates the display of the parent.

show or visible: wd'setp [show|visible] [0|1]'; hides [0] or shows [1] the parent. The parameter 1 may be elided.

stylesheet: wd'setp stylesheet styleinfo ' sets properties of the parent using a stylesheet. Qt allows the use of css-inspired stylesheets ( to set many of the visual display properties of a parent. For example, to set a QTextEdit parent to have dark blue text on a yellow background, with 12pt Georgia as the font, styleinfo would be *QTextEdit {color:#00007f;background-color:#ffffee; font: 12pt "Georgia";}.

taborder: wd'setp taborder idname idname [...] '; sets tab order (if Tab or Back-Tab key pressed) where idname are id of controls in the parent.

tooltip: wd'setp tooltip text '; sets tooltip text for the parent.

wh: wd'setp wh x y '; sets the width of the parent to x pixels and its height to y pixels.

Getp commands

wd'getp attribute [parameters] '

The above getp command retrieve the 'attribute' of the parent with optional parameters.

For the getp commands below, optional or alternative parameters are enclosed within brackets.

caption: wd'getp caption '; returns the window title.

children: wd'getp children '; returns a LF terminated list of all controls in the parent.

enable: wd'getp enable '; returns [0|1] for disabled or enabled.

extent: wd'getp extent text '; returns width, height in pixels if text is rendered using the current font of the parent.

focuspolicy: wd'getp focuspolicy '; returns the focus policy [click|strong|no] ( for the parent.

font: wd'getp font '; returns the fontspec of the parent..

hasfocus: wd'getp hasfocus '; returns [0|1], whether this parent has the keyboard input focus.

hwnd: wd'getp hwnd '; same as the wd qhwndp command.

id: wd'getp id '; returns the id of the parent.

lastfocus: wd'getp lastfocus '; returns the id of the control that had input focus during the last event.

locale: wd'getp locale '; returns the locale of the parent.

maxwh: wd'getp maxwh '; returns the maximum width and height (in pixels) for the parent.

minwh: wd'getp minwh '; returns the minimum width and height (in pixels) for the parent.

property: wd'getp property '; returns a LF terminated list of all attributes which can be used in getp commands.

sizepolicy: wd'getp sizepolicy '; returns both horizontal and vertical size policy. They are [fixed|maximum|minimum|preferred|expanding|minimumexpanding|ignored].

state: wd'getp state '; returns the state of the parent. Format is similar to that in wd q command.

sysdata: wd'getp sysdata '; returns the sysdata of the parent. Format is similar to that in wd q command.

sysmodifiers: wd'getp sysmodifiers '; returns the sysmodifiers of the parent.

stylesheet: wd'getp stylesheet '; return stylesheet of the parent.

tooltip: wd'getp tooltip '; returns tooltip text of the parent.

wh: wd'getp wh '; returns the width and height in pixels of the parent.

xywh: wd'getp xywh '; same as the wd qxywhp command.

visible: wd'getp visible '; returns [0|1] for visible or hidden.