BBjMDI::setBackgroundImageFile

Description

In BBj 17.0 and higher, this method places one or more background images on the MDI desktop.

Syntax

Return Value

Method

void

setBackgroundImageFile(int location, String filename)

Parameters

Variable

Description

location

 

One of the following image locations:

Constant

Value

Meaning

BBjMDI.FILL

-1

Image is stretched to fill the entire MDI desktop.

BBjMDI.CENTER

0

Image is centered within the MDI desktop.

BBjMDI.NORTHWEST

1

Image is placed in the upper left corner of the MDI desktop.

BBjMDI.NORTH

2

Image is placed in the middle of the top edge of the MDI desktop.

BBjMDI.NORTHEAST

3

Image is placed in the upper right corner of the MDI desktop.

BBjMDI.EAST

4

Image is placed in the middle of the right edge of the MDI desktop.

BBjMDI.SOUTHEAST

5

Image is placed in the lower right corner of the MDI desktop.

BBjMDI.SOUTH

6

Image is placed in the middle of the bottom edge of the MDI desktop.

BBjMDI.SOUTHWEST

7

Image is placed on the lower left corner of the MDI desktop.

BBjMDI.WEST

8

Image is placed in the middle of the left edge of the MDI desktop.

Multiple image locations are painted to the desktop in the  numeric order of these constants. A FILL image will appear under any other images.

filename

Specifies the background image to be displayed at the specified location, or null() to remove a background image.

Return Value

None.

Remarks

This method can be called from either the BBjMDI master process or from a BBjMDI client process. The original setBackgroundImage method depends on process-specific BBjImage references, so it can only be called from the BBjMDI master process.

Example

rem ' setBackgroundImageFile

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
mdi! = bbjapi().getMDI()
if argc > 1 and argv(1) = "client" then goto client
title$ = "MDI setBackgroundImage"
mdi!.createMDIWindow(50,50,1000,600,title$,$00090083$)
mdi!.setCallback(mdi!.ON_CLOSE,"eoj")
mdi!.addMenuBar()
mdi!.enableMDIWindowMenu()
mdi!.addStatusBar()
mdi!.setBackColor(sysgui!.makeColor(160,160,160))
invoke = scall("bbj " + pgm(-2) + " - client &")
if (msgbox("Set desktop background image?",4+32+256) = 6) then
    url$ = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Shiprock.snodgrass3.jpg/1280px-Shiprock.snodgrass3.jpg"
    image! = javax.imageio.ImageIO.read(new java.net.URL(url$))
    os! = new java.io.ByteArrayOutputStream()
    javax.imageio.ImageIO.write(image!,"png",os!)
    bytes! = os!.toByteArray()
    imagemanager! = sysgui!.getImageManager()
    image! = imagemanager!.loadImageFromBytes(bytes!)
    mdi!.setBackgroundImage(BBjMDI.FILL,image!)
endif

rem ' To remove a background image:
rem 'mdi!.setBackgroundImage(-1,null())
process_events

client:
    print 'hide',
    basis$ = System.getProperty("basis.BBjHome")
    addon$ = basis$ + "/barista/sys/images/"
    demos$ = basis$ + "/demos/images/"
    image$ = demos$+"bbj.png"
    mdi!.setBackgroundImageFile(BBjMDI.CENTER,image$)
    image$ = addon$+"addon_logo_32.png"
    mdi!.setBackgroundImageFile(BBjMDI.NORTHWEST,image$)
    image$ = addon$+"barista_about.png"
    mdi!.setBackgroundImageFile(BBjMDI.SOUTHEAST,image$)
    window! = sysgui!.addWindow(100,50,50,200,100,"MDI Client",$00010083$,$$)
    window!.setCallback(window!.ON_CLOSE,"eoj")
    process_events

eoj:
release

See Also

BBjAPI

BBjMDI

BBjImage

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