BBjMDI

Description

In BBj 3.0 and higher, the BBjMDI object represents an MDI (Multiple Document Interface) window used to display all windows created by an application being run through a thin client. The BBjMDI aggregates an internal BBjTopLevelWindow.

Creation

BBjAPI > BBjMDI

The BBjMDI object is created through the following BBjAPI object method:

Return Value

Method

BBjMDI

getMDI()

Methods of BBjMDI

Return Value

Method

BBjListButton

addListButton(int ID, int x, int y, int width, int height, string initialContents)

BBjListButton

addListButton(int ID, int x, int y, int width, int height, string initialContents, string flags)

BBjMenuButton

addMenuButton(int ID, int x, int y, int width, int height, string title)

BBjMenuButton

addMenuButton(int ID, int x, int y, int width, int height, string title, string flags)

BBjStatusBar

addStatusBar()

BBjStatusBar

addStatusBar(string flags)

BBjToolButton

addToolButton(int ID, int x, int y, int width, int height, string title)

BBjToolButton

addToolButton(int ID, int x, int y, int width, int height, string title, string flags)

void

approveMDIClose()

void

arrangeHorizontal()

void

arrangeVertical()

void

cascade()

boolean

closeAll(int timeoutInSeconds)

boolean

closeAllClients(int timeoutInSeconds)

int

countClients()

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)

void

enableMDIWindowMenu()

void

enableMDIWindowMenu(string windowLabel, string arrangeLabel, string cascadeLabel, string tileLabel, string horizontalLabel, string verticalLabel, string listLabel, string noVisibleFrameLabel)

boolean

getArrangeModal()

BBjMDIBorder

getBorder(int position)

int

getClientHeight()

int

getClientWidth()

int

getClientX()

int

getClientY()

string

getDefaultMDIMode()

int

getDesktopHeight()

int

getDesktopWidth()

BBjMDIBorder

getEastBorder()

boolean

getDefaultForwardMenuAccelerators()

boolean

getForwardMenuAccelerators(BBjTopLevelWindow window)

BBjListButton

getListButton(int controlID)

BBjListButton

getListButton(string name)

BBjMDIBorder

getNorthBorder()

BBjMenuButton

getMenuButton(int ID)

BBjMDIBorder

getSouthBorder()

BBjStatusBar

getStatusBar()

BBjToolButton

getToolButton(int ID)

BBjMDIBorder

getWestBorder()

boolean

isOutlineDrag()

void

registerMDIClosingCallback(string label)

void

registerMDIClosingCallback(CustomObject customObj, string methodName)

void

setArrangeModal(boolean arrangeModal)

void

setBackgroundImage(int location, BBjImage image)

void

setBackgroundImageFile(int location, String filename)

void

setDefaultForwardMenuAccelerators(boolean forwardKeys)

void

setDefaultMDIMode(string mode)

boolean

setForwardMenuAccelerators(BBjTopLevelWindow window, boolean forwardKeys)

void

setOutlineDrag(boolean dragMode)

void

tile()

void

unRegisterMDIClosingCallback()

void

vetoMDIClose()

BBjMDI Delegates the Following Methods to its BBjTopLevelWindow

Return Value

Method

BBjMenuBar

addMenuBar()

void

clearCallback(int eventType)

void

destroy()

void

focus()

int

getAvailableControlID()

BBjColor

getBackColor()

boolean

getClientEdge()

BBjFont

getFont()

BBjColor

getForeColor()

int

getHeight()

BBjMenuBar

getMenuBar()

BBjMenuBar

getMenuBar()

int

getRaisedEdge()

string

getTitle()

int

getWidth()

BBjImage

getWindowImage()

int

getX()

int

getY()

boolean

isEnabled()

boolean

isMaximized()

boolean

isMinimized()

boolean

isModal()

boolean

isOpaque()

boolean

isResizable()

boolean

isTitleBarVisible()

boolean

isVisible()

void

maximize()

void

minimize()

void

restore()

void

setBackColor(BBjColor color!)

void

setCallback(int eventType, string subRoutineName)

void

setClientEdge(boolean client)

void

setEnabled(boolean enabled)

void

setFont(BBjFont font!)

void

setForeColor(BBjColor color!)

void

setIcon(string filename)

void

setIcon(string filename, int index)

void

setLocation(int x, int y)

void

setRaisedEdge(boolean raised)

void

setResizable(boolean resizable)

void

setShortCue(string cue)

void

setSize(int width, int height)

void

setTitle(string title)

void

setTitleBarVisible (boolean  visible )

void

setVisible(boolean visible)

 

BUI logoCSS

The visual appearance of BUI controls is defined using CSS (cascading style sheets) rules. Easily change the default colors, border, and other settings by customizing these rules, all without changing any application code. See CSS API for a high-level overview of BUI CSS.

The top level BBjMDI window is a BBjTopLevelWindow. In addition to the .BBjTopLevelWindow style name, it also has the .BBjMDI style name.

Remarks

The program must be running in thin client mode.

Constants

Constant Description

MDI_CONTEXT

The context of the MDI window.

Example

BBjMDI_Example.bbj

rem ' BBjMDI
if len(cvs(argv(1,err=*next),8)) then goto client
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
mdi! = bbjapi().getMDI()
lf$ = str(javax.swing.UIManager@.getLookAndFeel())
title$ = "mdidock: "+info(0,0)+" "+info(0,1)+" "+info(1,0)+" "+info(1,1)+" "+lf$
print 'title'(title$)
mdi!.createMDIWindow(100,100,800,600,title$,$0000089f$)
mdi!.enableMDIWindowMenu()
mdi!.setArrangeModal(1)
mdi!.setVisible(1)
status! = mdi!.addStatusBar(); status!.setText("MDI Status Bar")
mdi!.setCallback(mdi!.ON_CLOSE,"closeAll")
mdi!.setCallback(mdi!.ON_RESIZE,"resize")
mdi!.setCallback(mdi!.ON_WINDOW_MOVE,"move")
mdi!.setCallback(mdi!.ON_SCREEN_RESIZE,"screen")
mdi!.setBackColor(sysgui!.makeColor(255,255,0))
imagemanager! = sysgui!.getImageManager()
image$ = "com/basis/utilities/launchdock/icons/bbj.png"
image! = imagemanager!.loadImageFromServerJar(image$)
mdi!.setBackgroundImage(0,image!)
mdi!.setDefaultMDIMode("MDI")
rem invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - n &")
rem invoke = scall("bbj "+pgm(-1)+" - f &")
gosub toolbar
rem invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - w &")
rem invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - e &")
rem invoke = scall("bbj "+pgm(-1)+" - f &")
rem invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - s &")
invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - f &")
invoke = scall("bbj "+pgm(-1)+" - f &")
mode = 0; rem msgbox("Select MDI mode",7+32+256,"MDI Mode","MDI","SDI","DETACHED")
mode$ = "MDI"
switch mode
   case 0; mode$ = "MDI"; break
   case 1; mode$ = "MDI"; break 
   case 2; mode$ = "SDI"; break
   case 3; mode$ = "DETACHED"; break
swend
mdi!.setDefaultMDIMode(mode$)
rem invoke = scall("bbj "+pgm(-1)+" - x "+mode$+" &")
gosub getSize
gosub getDesktopSize
gosub getClientSize
gosub getClientLocation
mdi!.setVisible(1)
gosub getSize
gosub getDesktopSize
gosub getClientSize
gosub getClientLocation
process_events
toolbar:
  tb! = mdi!.addToolButton(mdi!.getAvailableControlID(),0,0,50,50,"1",$4000$)
  print tb!.getID()
  tb!.setCallback(tb!.ON_TOOL_BUTTON_PUSH,"tb")
  mb! = mdi!.addMenuButton(mdi!.getAvailableControlID(),0,0,50,50,"2",$4000$)
  print mb!.getID()
  mb!.setCallback(mb!.ON_BUTTON_PUSH,"mb")
  lb$ = "cascade"+$0a$+"tile"+$0a$+"vertical"+$0a$+"horizontal"+$0a$
  lb! = mdi!.addListButton(mdi!.getAvailableControlID(),0,0,100,200,lb$,$4000$)
  print lb!.getID()
  lb!.setCallback(tb!.ON_LIST_SELECT,"lb")
return
tb:
  rem event! = sysgui!.getLastEvent()
  rem tb! = event!.getControl()
  rem tb = msgbox(tb!.getText(),0,event!.getEventName())
  info! = bbjapi().getCurrentSessionInfo()
  sessionid = info!.getSessionID()
  groupid = info!.getGroupID()
  infos! = bbjapi().getSessionInfos()
  all! = new java.util.LinkedHashSet()
  group! = new java.util.LinkedHashSet()
  for i = 0 to infos!.size() - 1
    info! = infos!.get(i)
    id = info!.getSessionID()
    group = info!.getGroupID()
    all!.add(id)
    if group=groupid then group!.add(id)
  next i
  info$ = "All Processes: "+str(all!)+$0a$+"Group Processes: "+str(group!)
  title$ = "MDI Process: "+str(sessionid)+" Group ID: "+str(groupid)
  i = msgbox(info$,0,title$)
return
mb:
  image! = mdi!.getWindowImage()
  image$ = image!.getBytes("png")
  image = unt
  open (image,mode="O_CREATE,O_TRUNC")"./BBjMDI.png"
  writerecord (image)image$
  close (image)
  event! = sysgui!.getLastEvent()
  mb! = event!.getControl()
  mb = msgbox(mb!.getText(),0,event!.getEventName())
return
lb:
  event! = sysgui!.getLastEvent()
  event$ = event!.getEventName()
  item$ = event!.getSelectedItem()
  index = event!.getSelectedIndex()
  switch index
    case 0; mdi!.cascade(); break
    case 1; mdi!.tile(); break
    case 2; mdi!.arrangeVertical(); break
    case 3; mdi!.arrangeHorizontal(); break
  swend
  lb = msgbox(item$,0,event$)
return
getSize:
  width = mdi!.getWidth()
  height = mdi!.getHeight()
  print "getSize",width,height
return
getDesktopSize:
  width = mdi!.getDesktopWidth()
  height = mdi!.getDesktopHeight()
  print "getDesktopSize",width,height
return
getClientSize:
  width = mdi!.getClientWidth()
  height = mdi!.getClientHeight()
  print "getClientSize",width,height
return
getClientLocation:
  x = mdi!.getClientX()
  y = mdi!.getClientY()
  print "getClientLocation",x,y
return
rem ' client windows
client:
if bbjapi().isInMDI() then bbjapi().getMDI().registerMDIClosingCallback("veto")
print 'hide',
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
title$ = cvs(argv(1),8)
print 'title'(title$)
if title$="f" then w=100,h=100 else w=50,h=50
window! = sysgui!.addWindow(rnd(250),rnd(250),w,h,title$,$00090083$,$00090083$)
rem window!.setMinimumSize(75,75)
window!.setTrack(1)
window!.setBackColor(sysgui!.makeColor(rnd(255),rnd(255),rnd(255)))
print title$," getBackColor ",window!.getBackColor()
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,"size")
checkbox! = window!.addCheckBox(2,25,0,25,25,title$,$0004$)
checkbox!.setCallback(checkbox!.ON_CHECK_ON,"resizable")
checkbox!.setCallback(checkbox!.ON_CHECK_OFF,"resizable")
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
message$ = "Initial window size: width="+str(window!.getWidth())+",height="+str(window!.getHeight())
window!.setToolTipText(message$)
print message$
if title$="x" then escape
process_events
veto:
  bbjapi().getMDI().approveMDIClose()
  release
closeAll:
  bbjapi().getMDI().closeAll(10)
eoj:
  release
size:
  message$ = "Window size: width="+str(window!.getWidth())+",height="+str(window!.getHeight())
  window!.setToolTipText(message$)
  print message$
return
resizable:
  window!.setResizable(checkbox!.isSelected())
return
screen:
  event! = sysgui!.getLastEvent()
  win! = event!.getControl()
  message$ = "ON_SCREEN_RESIZE: width="+str(event!.getWidth())+",height="+str(event!.getHeight())
  win!.setToolTipText(message$)
  print message$
return
resize:
  event! = sysgui!.getLastEvent()
  win! = event!.getControl()
  message$ = "ON_RESIZE: width="+str(event!.getWidth())+",height="+str(event!.getHeight())+",adjusting="+Boolean.toString(event!.isAdjusting())
  message$ = message$ + ".  Window reports width="+str(win!.getWidth())+",height="+str(win!.getHeight())
  win!.setToolTipText(message$)
  print message$
return
move:
  event! = sysgui!.getLastEvent()
  win! = event!.getControl()
  message$ = "ON_WINDOW_MOVE: x="+str(event!.getX())+",y="+str(event!.getY())
  message$ = message$ + ".  Window reports x="+str(win!.getX())+",y="+str(win!.getY())
  win!.setToolTipText(message$)
  print message$
return

See Also

BBjAPI

BBj Object Variables

BBj Object Creation and Assignment

BBj Object Error Handling

BBj Object Operators

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