BBjMDIBorder::getPosition

Description

In BBj 4.0 and higher, this method returns the location of the BBjMDIBorder.

Syntax

Return Value

Method

int

getPosition()

Parameters

None.

Return Value

Returns the location of the BBjMDIBorder, represented by one of the constants listed below:

BBjMDIBorder.NORTH = 0

BBjMDIBorder.SOUTH = 1

BBjMDIBorder.WEST = 2

BBjMDIBorder.EAST = 3

Remarks

None.

Example

rem ' BBjMDIBorder::getPosition

if len(cvs(argv(1,err=*next),8)) then goto client
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
mdi! = bbjapi().getMDI()
title$ = "BBjMDIBorder::getPosition: "+info(0,0)+" "+info(0,1)+" "+info(1,0)+" "+info(1,1)
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:
    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().getBorder(BBjMDIBorder.NORTH).setWindow(window!)
        position = bbjapi().getMDI().getNorthBorder().getPosition()
        print "BBjMDIBorder.NORTH",position,": ",window!.getTitle()
    endif
    if (title$="s") then
        bbjapi().getMDI().getBorder(BBjMDIBorder.SOUTH).setWindow(window!)
        position = bbjapi().getMDI().getSouthBorder().getPosition()
        print "BBjMDIBorder.SOUTH",position,": ",window!.getTitle()
    endif
    if (title$="w") then
        bbjapi().getMDI().getBorder(BBjMDIBorder.WEST).setWindow(window!)
        position = bbjapi().getMDI().getWestBorder().getPosition()
        print "BBjMDIBorder.WEST",position,": ",window!.getTitle()
    endif
    if (title$="e") then
        bbjapi().getMDI().getBorder(BBjMDIBorder.EAST).setWindow(window!)
        position = bbjapi().getMDI().getEastBorder().getPosition()
        print "BBjMDIBorder.EAST",position,": ",window!.getTitle()
    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

BBjSysGui

BBjControl

BBjWindow

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