BBjMDI::addListButton

Description

In BBj 17.0 and higher, this method adds a BBjListButton to the BBjMDI toolbar.

Syntax

Return Value

Method

BBjListButton

addListButton(int ID, int x, int y, int width, int height, string initialContents)

BBjListButton

addToolButton(int ID, int x, int y, int width, int height, string initialContents, string flags)

Parameters

Variable

Description

ID

Control ID number. It must be an integer between 1 and 32767 and be unique within a given top-level window.

x

Horizontal position of the upper-left corner of the control in current units.

y

Vertical position of the upper-left corner of the control in current units.

width

Width of the control in current units.

height

Height of the control in current units.

initialContents

Line feed separated strings containing the initial contents of the list.

flags

Control flags, as follows:

Flag Description

$0001$

Sets the control to be initially disabled.

$0010$

Sets the control to be initially invisible.

$0800$

Creates a "click on, click off" toggle button.

$1000$

Draws a recessed client edge around the control.

$2000$

Left justifies the list items.

$4000$

Centers list items.

$8000$

Right-justifies list items.

Return Value

Returns the created BBjListButton object.

Remarks

The list of choices available may be modified only under program control. The values in the list may be accessed using a zero-based list index integer. Unlike the list edit control, it does not allow a value to be entered manually. As the user types, the first matching selection in the list is placed in the edit area. Various keys may be used to navigate in the list including the Home (first selection), End (last selection), Page Up and Page Down, and the arrow keys.

Example

rem ' BBjMDI::addListButton
if len(cvs(argv(1,err=*next),8)) then goto client
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
mdi! = bbjapi().getMDI()
title$ = "BBjMDI::addListButton"
print 'title'(title$)
mdi!.createMDIWindow(100,100,800,600,title$,$0000009f$)
mdi!.setVisible(1)
status! = mdi!.addStatusBar(); status!.setText("MDI Status Bar")
mdi!.setCallback(mdi!.ON_CLOSE,"eoj")
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!)
rem invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - n &"); wait 0.1
rem invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
gosub toolbar
rem invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - w &"); wait 0.1
rem invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - e &"); wait 0.1
rem invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
rem invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - s &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
invoke = scall("bbj "+pgm(-1)+" - f &"); wait 0.1
process_events
toolbar:
  tb! = mdi!.addToolButton(101,0,0,50,50,"1",$4000$)
  tb!.setCallback(tb!.ON_TOOL_BUTTON_PUSH,"tb")
  mb! = mdi!.addMenuButton(102,0,0,50,50,"2",$4000$)
  mb!.setCallback(mb!.ON_BUTTON_PUSH,"mb")
  lb$ = ""; for lb = 0 to 9; lb$ = lb$ + str(lb) + $0a$; next lb
  lb! = mdi!.addListButton(103,0,0,100,200,lb$,$4000$)
  lb!.setCallback(tb!.ON_LIST_SELECT,"lb")
return
tb:
  event! = sysgui!.getLastEvent()
  tb! = event!.getControl()
  tb = msgbox(tb!.getText(),0,event!.getEventName())
return
mb:
  event! = sysgui!.getLastEvent()
  mb! = event!.getControl()
  mb = msgbox(mb!.getText(),0,event!.getEventName())
return
lb:
  event! = sysgui!.getLastEvent()
  lb! = event!.getControl()
  lb = msgbox(event!.getSelectedItem(),0,event!.getEventName())
return
rem ' client windows
client: 
print 'hide',
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
title$ = cvs(argv(1),8)
print 'title'(title$)
x=rnd(250),y=rnd(250)
if title$="f" then w=100,h=100 else w=50,h=50
window! = sysgui!.addWindow(x,y,w,h,title$,$00090083$,$00090083$)
window!.setTrack(1)
window!.setBackColor(sysgui!.makeColor(rnd(255),rnd(255),rnd(255)))
window!.setCallback(window!.ON_CLOSE,"eoj")
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().getNorthBorder().setWindow(window!)
endif
if title$="s" then
   bbjapi().getMDI().getSouthBorder().setWindow(window!)
endif
if title$="w" then
   bbjapi().getMDI().getWestBorder().setWindow(window!)
endif
if title$="e" then
   bbjapi().getMDI().getEastBorder().setWindow(window!)
endif
process_events
eoj:
event! = sysgui!.getLastEvent()
release

See Also

BBjAPI

BBjControl

BBjMDI

BBjWindow

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