BBjMenuItem::setImage

Description

In BBj 7.0 and higher, this method sets the image for a BBjMenuItem.

Syntax

Return Value

Method

void

setImage(BBjImage image)

Parameters

Variable

Description

image

BBjImage for this BBjMenuItem.

Return Value

None.

Remarks

None.

Example

rem ' BBjMenuItem setImage

sysgui = unt
open (sysgui)"X0"

sysgui! = BBjAPI().getSysGui()
imageManager! = sysgui!.getImageManager()

window! = sysgui!.addWindow(100,100,200,100,"setImage",$00010003$)
menubar! = window!.addMenuBar()

fileMenu! = menubar!.addMenu(-100,"&File")

newImage$ = "com/basis/bbj/images/new.gif"
newImage! = imageManager!.loadImageFromServerJar(newImage$)
newMenuItem! = fileMenu!.addMenuItem(-101,"&New")
newMenuItem!.setImage(newImage!)
newMenuItem!.setAccelerator($20$+"N"); rem ' CTRL+N

openImage$ = "com/basis/bbj/images/open.gif"
openImage! = imageManager!.loadImageFromServerJar(openImage$)
openMenuItem! = fileMenu!.addMenuItem(-102,"&Open...")
openMenuItem!.setImage(openImage!)
openMenuItem!.setAccelerator($20$+"O"); rem ' CTRL+O

saveImage$ = "com/basis/bbj/images/save.gif"
saveImage! = imageManager!.loadImageFromServerJar(saveImage$)
saveMenuItem! = fileMenu!.addMenuItem(-103,"&Save")
saveMenuItem!.setImage(saveImage!)
saveMenuItem!.setAccelerator($20$+"S"); rem ' CTRL+S

printImage$ = "com/basis/bbj/images/print.gif"
printImage! = imageManager!.loadImageFromServerJar(printImage$)
printMenuItem! = fileMenu!.addMenuItem(-104,"&Print")
printMenuItem!.setImage(printImage!)
printMenuItem!.setAccelerator($20$+"P"); rem ' CTRL+P

exitMenuItem! = fileMenu!.addMenuItem(-105,"E&xit")

editMenu! = menubar!.addMenu(-200,"&Edit")

cutImage$ = "com/basis/bbj/images/cut.gif"
cutImage! = imageManager!.loadImageFromServerJar(cutImage$)
cutMenuItem! = editMenu!.addMenuItem(-32027,"Cu&t")
cutMenuItem!.setImage(cutImage!)
cutMenuItem!.setAccelerator($20$+"X"); rem ' CTRL+X

copyImage$ = "com/basis/bbj/images/copy.gif"
copyImage! = imageManager!.loadImageFromServerJar(copyImage$)
copyMenuItem! = editMenu!.addMenuItem(-32028,"&Copy")
copyMenuItem!.setImage(copyImage!)
copyMenuItem!.setAccelerator($20$+"C"); rem ' CTRL+C

pasteImage$ = "com/basis/bbj/images/paste.gif"
pasteImage! = imageManager!.loadImageFromServerJar(pasteImage$)
pasteMenuItem! = editMenu!.addMenuItem(-32029,"&Paste")
pasteMenuItem!.setImage(pasteImage!)
pasteMenuItem!.setAccelerator($20$+"V"); rem ' CTRL+V

editBox1! = window!.addEditBox(101,10,10,80,30,"Edit Box",$$)
editBox2! = window!.addEditBox(102,10,50,80,30,"Edit Box",$$)

CALLBACK(ON_CLOSE,APP_CLOSE,sysgui!.getContext())
CALLBACK(ON_MENU_ITEM_SELECT,menu_item,newMenuItem!.getContextID(),newMenuItem!.getID())
CALLBACK(ON_MENU_ITEM_SELECT,menu_item,newMenuItem!.getContextID(),openMenuItem!.getID())
CALLBACK(ON_MENU_ITEM_SELECT,menu_item,newMenuItem!.getContextID(),saveMenuItem!.getID())
CALLBACK(ON_MENU_ITEM_SELECT,menu_item,newMenuItem!.getContextID(),printMenuItem!.getID())
CALLBACK(ON_MENU_ITEM_SELECT,app_close,exitMenuItem!.getContextID(),exitMenuItem!.getID())

process_events

APP_CLOSE:
release

MENU_ITEM:
    item! = BBjAPI().getSysGui().getLastEvent().getControl()
    I = MSGBOX("Menu item selected: "+item!.getText())
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

BBjMenu

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