BBjWindow::getWindowImage

Description

In BBj 15.0 and higher, this method returns a BBjWindow as a BBjImage.

Syntax

Return Value

Method

BBjImage

getWindowImage()

Parameters

None.

Return Value

Returns the window as a BBjImage.

Remarks

None.

Example

rem ' getWindowImage

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(250,250,250,300,"getWindowImage",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")
child! = window!.addChildWindow(99,0,0,250,300,1)
child!.setBorderColor(BBjColor.GREEN)
windowImage! = child!.addButton(1,25,25,200,25,"getWindowImage",$$)
windowImage!.setCallback(windowImage!.ON_BUTTON_PUSH,"getWindowImage")
childImage! = child!.addButton(2,25,75,200,25,"getChildImage",$$)
childImage!.setCallback(windowImage!.ON_BUTTON_PUSH,"getChildImage")
outerBounds! = child!.addButton(3,25,125,200,25,"setOuterBounds",$$)
outerBounds!.setCallback(outerBounds!.ON_BUTTON_PUSH,"setOuterBounds")
screenImage! = child!.addButton(4,25,175,200,25,"getScreenImage(x,y,w,h)",$$)
screenImage!.setCallback(screenImage!.ON_BUTTON_PUSH,"getScreenImage")
child!.addStaticText(201,30,225,50,25,"X",$$)
child!.addStaticText(202,80,225,50,25,"Y",$$)
child!.addStaticText(203,130,225,50,25,"W",$$)
child!.addStaticText(204,180,225,50,25,"H",$$)
x! = child!.addInputN(101,25,250,50,25)
y! = child!.addInputN(102,75,250,50,25)
w! = child!.addInputN(103,125,250,50,25)
h! = child!.addInputN(104,175,250,50,25)
gosub setOuterBounds
process_events

eoj:
release

resize:
    event! = sysgui!.getLastEvent()
    child!.setSize(event!.getWidth(),event!.getHeight())
return

getWindowImage:
    gosub getOuterBounds
    image! = window!.getWindowImage()
    image$ = image!.getBytes("png")
    image = unt
    filename$ = System.getProperty("user.home") + "/Desktop/getWindowImage.png"
    open (image,mode="O_CREATE,O_TRUNC")filename$
    writerecord (image)image$
    close (image)
return

getChildImage:
    gosub getOuterBounds
    image! = child!.getWindowImage()
    image$ = image!.getBytes("png")
    image = unt
    filename$ = System.getProperty("user.home") + "/Desktop/getChildImage.png"
    open (image,mode="O_CREATE,O_TRUNC")filename$
    writerecord (image)image$
    close (image)
return

getScreenImage:
    gosub getOuterBounds
    x = x!.getValue()
    y = y!.getValue()
    w = w!.getValue()
    h = h!.getValue()
    if (x or y or w or h) then
        image! = sysgui!.getSystemMetrics().getScreenImage(x,y,w,h)
    else
        image! = sysgui!.getSystemMetrics().getScreenImage()
    endif
    image$ = image!.getBytes("png")
    image = unt
    filename$ = System.getProperty("user.home") + "/Desktop/getScreenImage.png"
    open (image,mode="O_CREATE,O_TRUNC")filename$
    writerecord (image)image$
    close (image)
return

getOuterBounds:
    x = window!.getOuterX()
    y = window!.getOuterY()
    w = window!.getOuterWidth()
    h = window!.getOuterHeight()
    print "Outer bounds =",x,y,w,h
return

setOuterBounds:
    x!.setValue(window!.getOuterX())
    y!.setValue(window!.getOuterY())
    w!.setValue(window!.getOuterWidth())
    h!.setValue(window!.getOuterHeight())
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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