
BBjMDI::createMDIWindow
Description
Creates the BBjMDI window used by the process. The act of creating a BBjMDI window has an effect on the manner in which new SCALLed versions of BBj display. If the program that has created a BBjMDI window makes a call of the form:
X = SCALL("bbj ...<someProgram> ....&)
Any windows created by <someProgram> display within the user area of the BBjMDI window.
Syntax
Return Value |
Method |
---|---|
void |
createMDIWindow(int x, int y, int width, int height, string title) |
void |
createMDIWindow(int x, int y, int width, int height, string title, string flags) |
Parameters
Variable |
Description |
||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
Horizontal position of the upper-left corner of the window in current units. |
||||||||||||||||||||||
y |
Vertical position of the upper-left corner of the window in current units. This value does not take into account the space taken by menus or title bars. If a window is defined with a menu and a title bar and its y parameter is set to zero, the menu and title bar will not be visible when a BBj program displays the window. The y parameter should be adjusted by 20 pixels to account for a menu and 20 pixels for a title bar. For example, if a window has a menu and a title bar and the y parameter is set to 60, the top of the title bar will appear 20 pixels from the top of the screen when a BBj program displays the window. |
||||||||||||||||||||||
width |
Width of the window in current units. |
||||||||||||||||||||||
height |
Height of the window in current units. |
||||||||||||||||||||||
title |
The title of the new window. This is the initial title and can be changed at any time with the TITLE Mnemonic - Set Window Title. |
||||||||||||||||||||||
flags |
If the flags parameter is omitted, a default
value of $0000000f$ is used.
|
Return Value
None.
Remarks
None.
Example
MDI Example
rem ' mdi
print 'hide',
if len(cvs(argv(1,err=*next),8)) then goto client
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
mdi! = bbjapi().getMDI()
title$ = "mdi "+info(0,0)+" "+info(0,1)+" "+info(1,0)+" "+info(1,1)
mdi!.createMDIWindow(100,100,500,500,title$,$0100008f$)
mdi!.setCallback(mdi!.ON_CLOSE,"eoj")
menubar! = mdi!.addMenuBar()
menu! = menubar!.addMenu(99,"File")
menuitem! = menu!.addMenuItem(100,"Exit")
menuitem!.setCallback(menuitem!.ON_MENU_ITEM_SELECT,"eoj")
status! = mdi!.addStatusBar(); status!.setText("MDI Status Bar")
gosub toolbar
invoke = scall("bbj "+pgm(-1)+" - n &")
invoke = scall("bbj "+pgm(-1)+" - w &")
invoke = scall("bbj "+pgm(-1)+" - e &")
invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - s &")
process_events
toolbar:
tb1! = mdi!.addToolButton(101,0,0,25,25,"1",$4000$)
tb1!.setCallback(tb1!.ON_TOOL_BUTTON_PUSH,"tb")
tb2! = mdi!.addToolButton(102,0,0,25,25,"2",$4000$)
tb2!.setCallback(tb1!.ON_TOOL_BUTTON_PUSH,"tb")
tb3! = mdi!.addToolButton(103,0,0,25,25,"3",$4000$)
tb3!.setCallback(tb1!.ON_TOOL_BUTTON_PUSH,"tb")
return
tb:
event! = sysgui!.getLastEvent()
tb! = event!.getControl()
tb = msgbox(tb!.getText(),0,"MDI Toolbar")
return
rem ' client windows
client:
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
title$ = cvs(argv(1),8)
print 'title'(title$)
window! = sysgui!.addWindow(150,150,50,50,title$,$00090003$,$00090083$)
window!.setTrack(1)
window!.setBackColor(sysgui!.makeColor(rnd(255),rnd(255),rnd(255)))
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")
window!.setCallback(window!.ON_SCREEN_RESIZE,"screen")
window!.setCallback(window!.ON_WINDOW_MOVE,"move")
button! = window!.addMenuButton(1,0,0,25,25,title$,$$)
button!.setCallback(button!.ON_BUTTON_PUSH,"focus")
checkbox! = window!.addCheckBox(2,25,0,25,25,title$,$0004$)
checkbox!.setToolTipText("Resizable")
checkbox!.setCallback(checkbox!.ON_CHECK_ON,"resizable")
checkbox!.setCallback(checkbox!.ON_CHECK_OFF,"resizable")
editbox! = window!.addEditBox(101,0,25,25,25,title$,$$)
status! = window!.addStatusBar(99,$$)
status!.setForeColor(sysgui!.makeColor(255,255,255))
status!.setBackColor(sysgui!.makeColor(0,0,255))
status!.setText("Status Bar")
if title$="n" then
bbjapi().getMDI().getNorthBorder().setWindow(window!)
endif
if title$="s" then
bbjapi().getMDI().getSouthBorder().setWindow(window!)
endif
if title$="w" then
bbjapi().getMDI().getWestBorder().setWindow(window!)
endif
if title$="e" then
bbjapi().getMDI().getEastBorder().setWindow(window!)
endif
if title$="f" then
window!.setSize(150,75)
endif
process_events
eoj:
release
focus:
editbox!.focus()
return
resizable:
window!.setResizable(checkbox!.isSelected())
return
screen:
event! = sysgui!.getLastEvent()
message$ = "ON_SCREEN_RESIZE: width="+str(event!.getWidth())+",height="+str(event!.getHeight())
window!.setToolTipText(message$)
print message$
return
resize:
event! = sysgui!.getLastEvent()
message$ = "ON_RESIZE: width="+str(event!.getWidth())+",height="+str(event!.getHeight())
message$ = message$ + ". Window reports width="+str(window!.getWidth())+",height="+str(window!.getHeight())
window!.setToolTipText(message$)
print message$
return
move:
event! = sysgui!.getLastEvent()
message$ = "ON_WINDOW_MOVE: x="+str(event!.getX())+",y="+str(event!.getY())
message$ = message$ + ". Window reports x="+str(window!.getX())+",y="+str(window!.getY())
window!.setToolTipText(message$)
print message$
return
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.