Parent=None

From Br Wiki
Jump to: navigation, search

A parent=none Open Display statement will create a new window, which may be a modal child of the main window.

PARENT=NONE is available for Windows and Client Server models only.

If GUI mode is ON then PARENT=NONE may be stated when OPENing a window. This will create an independent window using the specified channel. The new window inherits any unspecified attributes from the program's main console.

When a GUI mode switch is made, all windows are closed and the main console is reopened. Note that Parent=None windows are NOT main consoles. Attempts to output to a previously existing non-console window after a mode switch, without opening it fresh, will generate error 0704 (file not open).

Any attempt to open a window with Parent=None while GUI mode is OFF produces error 0877.

OPEN ... "… ROW= ,COL= " specifies the preferred position of the new independent window relative to window zero (the main console). Negative values can be used to position the window to the left of or above the main console. BR will attempt to honor the request keeping the new window entirely viewable up to the maximum size of the screen. 'NAME=window-name' indicates that BR is to save the position of the window at the time it is closed and restore it when it is reopened, even across sessions. Replacement or overlaying windows can use the same window names to position themselves wherever and at whatever character size the user has changed it to. So once a window has been opened with a particular name, subsequent OPENs ignore ROW= and COL= and instead use the stored values.

Some keywords may be added to tweek the user experience, including:

  • RELATIVE
  • ABSOLUTE
  • MODAL

OPEN window Parent=None positions the window relative to the screen if ROW and COL are specified: Note- Open #0 doesn't honor this because once it has been opened, it keeps the last location of the window in the registry. ( ROW/COL, ROWS/COLS and FONTSIZE )

DISPLAY MENU

DISPLAY #window,MENU

#window may be any open window number. The program will automatically find the corresponding top window. This means that you can specify your current child window without having to identify its corresponding Parent=NONE window number.

SAMPLE of PARENT=NONE

Below is an example program.

00100 ! Run This Program With The Br Main Screen Unmaximized
00120 ! Run It More Than Once With The Br Main Screen In Different Positions
00140 ! Repositioning The Named Windows Are Be Remembered From Run To Run.
00160    open #1: "parent=none,RELATIVE,srow=0,scol=0, rows=10,cols=50,fontsize=20x10",display,output
00180    print #1, fields "1,1,c,s": "This PARENT=NONE window was positioned relative to window #0.  Press any key to continue"
00200    let KSTAT$(1)
00220    close #1:
00240    open #1: "parent=none,RELATIVE,srow=-4,scol=-4, rows=10,cols=50,fontsize=20x10",display,output
00260    print #1, fields "1,1,c,s": "This PARENT=NONE window was also positioned relative to winow #0.  It uses a negative SROW and SCOL.  Press any key to continue"
00280    let KSTAT$(1)
00300    close #1:
00320    open #1: "parent=none,ABSOLUTE,srow=0,scol=0, rows=10,cols=50,fontsize=20x10",display,output
00340    print #1, fields "1,1,c,s": "This PARENT=NONE window was positioned on the absolute screen coordinates.  Press any key to continue"
00360    let KSTAT$(1)
00380    close #1:
00400    open #1: "parent=none,ABSOLUTE,srow=10,scol=10, rows=10,cols=50,fontsize=20x10",display,output
00420    print #1, fields "1,1,c,s": "This PARENT=NONE window was positioned on the absolute screen coordinates at 10,10.  Note that SROW and SCOL are now measured in character sizes based on the specified FONTSIZE.  Press any key to continue"
00440    let KSTAT$(1)
00460    close #1:
00480    open #1: "parent=none,ABSOLUTE,srow=0,scol=0, rows=10,cols=50,fontsize=20x10,name=AbsolutePositionExample_1",display,output
00500    print #1, fields "1,1,c,s": "This PARENT=NONE window was positioned on the absolute screen coordinates.  This window saves its screen size and position based on name=AbsolutePositionExample_1.  You can move this window around and it will open in the new place the next time you run this example.  Press any key to continue"
00520    let KSTAT$(1)
00540    close #1:
00560    open #1: "parent=none,RELATIVE,srow=0,scol=0, rows=10,cols=50,fontsize=20x10,name=RelativePositionExample_1",display,output
00580    print #1, fields "1,1,c,s": "This PARENT=NONE window was positioned relative to window #0.  This window saves its screen size and position based on name=RelativePositionExample_1.  It saves this information relative to window #0.  You can move this window around and it will open in the new place relative to window #0 the next time you run this example.  Note: This saved position is relative to window #0.  This means that if window #0 is moved, the saved position will move right along with it.  Press any key to continue"
00600    let KSTAT$(1)
00620    close #1:
00640    print fields "1,1,c,,B1001": "This button cannot be clicked while there is a modal window open"
00660    open #1: "parent=none, RELATIVE, srow=10, scol=10, rows=10, cols=50, fontsize=20x10, MODAL", display, output
00680    print #1, fields "1,1,c,s": "This window was opened MODAL.  Note that you cannot interact with window #0 while it is opened.  Also note that it does not have a task bar icon.  Press Ok to continue"
00700    print #1, fields "6, 22, C,,B1001": "Ok"
00720    do WHILE (FKEY <> 1001)
00740       let KSTAT$(1)
00760    loop
00780    close #1:
00800    print NEWPAGE
00820    open #1: "parent=none,RELATIVE,srow=0,scol=0, rows=10,cols=50,fontsize=20x10, NO_TASK_BAR", display, output
00840    print #1, fields "1,1,c,s": "This PARENT=NONE window does not have a task bar item.  Press any key to continue"
00860    let KSTAT$(1)
00880    close #1:

Related Topics

CURWINDOW - This constant returns the window that is active (-1) will be returned if not "Parent=None" is active.

DISPLAY #window, - Menu's may be displayed within a Parent=NONE, use the #window to define the current window.