BBjWindow::addChildWindow

Description

Adds a child window in the BBjWindow.

Syntax

Return Value

Method

BBjChildWindow addChildWindow(int context)
BBjChildWindow addChildWindow(int ID, int context)

BBjChildWindow

addChildWindow(int ID, number x, number y, number w, number h, int context)

BBjChildWindow

addChildWindow(int ID, number x, number y, number w, number h, string title, int context)

BBjChildWindow

addChildWindow(int ID, number x, number y, number w, number h, string title, string flags, int context)

BBjChildWindow

addChildWindow(int ID, number x, number y, number w, number h, string title, string flags, int context, string eventMask)

BBjChildWindow addChildWindow(int ID, string title, int context)
BBjChildWindow addChildWindow(int ID, string title, string flags, int context)
BBjChildWindow addChildWindow(int ID, string title, string flags, int context, string eventMask)
BBjChildWindow addChildWindow(string title, int context)
BBjChildWindow addChildWindow(string title, string flags, int context)
BBjChildWindow addChildWindow(string title, string flags, int context, string eventMask)

Parameters

Variable

Description

ID

Control ID number. It must be an integer between 1 and 32767 and be unique within a given top-level window.

x

Horizontal position of the upper-left corner of the child window.

y

Vertical position of the upper-left corner of the child window.

w

Width of the child window, in pixels.

h

Height of the child window, in pixels.

title

Title of the child window.

flags

Control flags, as follows:

Flag Description

$00000004$

Horizontal Scrollbar: Causes a horizontal scroll bar to appear whenever the window is resized to be smaller than its initial size and setTrack(0) is specified.

$00000008$

Vertical Scrollbar: Causes a vertical scroll bar to appear whenever the window is resized to be smaller than its initial size and setTrack(0) is specified.

$00000010$

Invisible: Sets the child window to be initially invisible.

$00000020$

Disabled: Sets the child window to be initially disabled.

$00000800$

Borderless: Creates a child window without a border.

$00001000$

Fieldset Element: In BBj 22.00 and higher, if creation flag $00008000$ is also specified, the simple child window is created as a fieldset element to emulate groupbox functionality. The default implementation uses a div element. This option is only meaningful in the DWC client.

$00008000$

Simple: In BBj 22.00 and higher, creates a simple child window that doesn't support a status bar or internal docked child windows. This option is only meaningful in the DWC client.

$00010000$

Keyboard Navigation: Activates keyboard navigation in the child window. If this flag is specified, key pressed ("t") events for arrow keys and the tab key will not be reported.

$00100000$

Automatic Layout: Automatically arranges all controls to fit within the child window. In the DWC client, this flag causes the window to use dynamic flow layout, ignoring all absolute control sizes and positions.

DWC logoNote:

When creating a child window through an ARC file in WindowBuilder, this flag is not currently exposed in the UI, and corresponds to the "GRAVITY" flag. To enable flow layout in the DWC, add a line with the keyword GRAVITY to the ARC source file in the section with the child window properties.

$00200000$

Docking: Attaches the child window to one side of the parent frame, by default to the top frame. It will always occupy the full extent of the parent window's edge (even if the parent is resized later), but the other dimension is determined by the width or height specified when the child was created. By default, docked child windows are attached to the top of their parent. This can be changed with the 'DOCK' mnemonic.

$00800000$

Enter as Tab: Sets the Enter key to behave as a Tab key.

$01000000$

Recessed Edge: Draws a recessed client edge around the child window.

$02000000$

Raised Edge: Draws a raised edge around the child window.

$08000000$

Unique Names: In BBj 8.00 and higher, causes the window to enforce unique control names. See BBjWindow::getControl.

$10000000$

Mouse Events: In BBj 15.00 and higher, causes the window to report all mouse events for all controls.

$20000000$

Keypress Events: In BBj 15.00 and higher, causes the window to report all keypress events for all controls.

$80000000$

TRACK'(0)': In BBj 17.00 and higher, creates the window with 'TRACK'(0) instead of the default 'TRACK'(1). Use this option to enable scrolling behavior in the child window.

context

An empty context for the child window to occupy. The child can then be referenced either by its ID number from within the parent context or by the ID 0 from its own context. Either method can be used in most cases.

eventMask

Event mask to be applied to the child window. For additional information, see SYSGUI Event Queue.   

Return Value

Returns the created BBjWindow object.

Remarks

If the ID parameter is not specified, a control ID is assigned dynamically using getAvailableControlID().

If the x, y, width, and height parameters are not specified, they are all initialized to 0. This is typically for use with DWC windows that dynamically arrange their contents (window creation flag $00100000$).

Example

rem 'Add a child window to a top level window

rem 'Obtain the instance of the BBjAPI object
let myAPI!=BBJAPI()

rem 'Open the SysGui device
let SYSGUI=UNT
OPEN (SYSGUI)"X0"

rem 'Obtain the instance of the BBjSysGui object
let mySysGui!=myAPI!.getSysGui()

rem 'Set addWindow param values
let X=10
let Y=10
let WIDTH=200
let HEIGHT=200
let TITLE$="BBj Window"

rem 'Set the current context
mySysGui!.setContext(0)

rem 'Create a top level window
let myWindow!=mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)

rem 'Create a child window
let myChildWindow!=myWindow!.addChildWindow(200,50,50,100,100,"",$$,1,$$)

rem 'Add a static text control on the child window
CHILD_TEXT$="Child Window"
let myStaticText!=myChildWindow!.addStaticText(300,X,Y,WIDTH,HEIGHT,CHILD_TEXT$)

rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,0)

rem 'Process Events
process_events

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

CHILD Mnemonic - Create a Child Window

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.