BBjMDI::setBackgroundImage

Description

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

Syntax

Return Value

Method

void

setBackgroundImage(int location, BBjImage image)

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.

image

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

Return Value

None.

Remarks

This method depends on process-specific  BBjImage  references, so it can only be called from the BBjMDI master process. In BBj 17 and higher,  setBackgroundImageFile  is available, and can be called from either the BBjMDI master process or from a BBjMDI client process.

Example

rem ' setBackgroundImage

basis$ = System.getProperty("basis.BBjHome")

addon$ = basis$ + "/barista/sys/images/"

demos$ = basis$ + "/demos/images/"

sysgui = unt

open (sysgui)"X0"

sysgui! = bbjapi().getSysGui()

if argc > 1 and argv(1) = "client" then goto client

mdi! = bbjapi().getMDI()

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))

imagemanager! = sysgui!.getImageManager()

image! = imagemanager!.loadImageFromFile(demos$+"bbj.png")

mdi!.setBackgroundImage(BBjMDI.CENTER,image!)

image! = imagemanager!.loadImageFromFile(addon$+"addon_logo_32.png")

mdi!.setBackgroundImage(BBjMDI.NORTHWEST,image!)

image! = imagemanager!.loadImageFromFile(addon$+"barista_about.png")

mdi!.setBackgroundImage(BBjMDI.SOUTHEAST,image!)

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()

   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',

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.