BBjRadioGroup

Description

In BBj 5.0 and higher, the BBjRadioGroup object provides methods for manipulating a collection of related GUI radio button controls.

Implemented Interfaces

None.

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjRadioButton > BBjRadioGroup

A BBjRadioGroup object is created through the following BBjWindow methods:

Return Value

Method

BBjRadioGroup

addRadioGroup()

BBjRadioGroup

addRadioGroup(BBjVector radiobuttons!)

Methods of BBjRadioGroup

Return Value

Method

void

add(BBjRadioButton radioButton!)

void

clearCallback(int eventType)

String getName()

BBjRadioButton

getSelected()

void

remove(BBjRadioButton radioButton!)

void setCallback(int eventType, customObject obj String methodName)
void setCallback(int eventType, String subroutineName)
void setName(String name)

Events

Callback Code Object-oriented Event Read Record Event Code
ON_SELECTION_CHANGE BBjSelectionChangeEvent Radio Group Selection Change Event g

Remarks

The BBjRadioGroup is the structure that defines the mutual exclusivity of a set of radio buttons, such that selecting one causes all others in the group to become unselected. Radio buttons are also usually set to be in a keyboard navigation group .

In BBj 23+, the BBjRadioGroup implements some methods normally associated with BBjControl (setName, getName, setCallback, getCallback), but it is not a BBjControl.

Example

rem ' BBjRadioGroup

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(25,25,800,500,"BBjRadioGroup",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")

rem ' RadioGroup 1
rb1! = window!.addRadioButton(101,25,25,150,25,"RadioButton1",$0020$)
rb1!.setCallback(rb1!.ON_CHECK_ON,"event")
rb1!.setCallback(rb1!.ON_CHECK_OFF,"event")
rb2! = window!.addRadioButton(102,25,50,150,25,"RadioButton2",$0020$)
rb2!.setCallback(rb2!.ON_CHECK_ON,"event")
rb2!.setCallback(rb2!.ON_CHECK_OFF,"event")
rb3! = window!.addRadioButton(103,25,75,150,25,"RadioButton3",$0020$)
rb3!.setCallback(rb3!.ON_CHECK_ON,"event")
rb3!.setCallback(rb3!.ON_CHECK_OFF,"event")
rb4! = window!.addRadioButton(104,25,100,150,25,"RadioButton4",$0020$)
rb4!.setCallback(rb4!.ON_CHECK_ON,"event")
rb4!.setCallback(rb4!.ON_CHECK_OFF,"event")
rg1! = window!.addRadioGroup()
rg1!.setName("RadioGroup1",err=*next)
rg1!.add(rb1!)
rg1!.add(rb2!)
rg1!.add(rb3!)
rg1!.add(rb4!)

rem ' RadioGroup 2
rb5! = window!.addRadioButton(105,200,25,150,25,"RadioButton5",$0020$)
rb5!.setCallback(rb5!.ON_CHECK_ON,"event")
rb5!.setCallback(rb5!.ON_CHECK_OFF,"event")
rb6! = window!.addRadioButton(106,200,50,150,25,"RadioButton6",$0020$)
rb6!.setCallback(rb6!.ON_CHECK_ON,"event")
rb6!.setCallback(rb6!.ON_CHECK_OFF,"event")
rb7! = window!.addRadioButton(107,200,75,150,25,"RadioButton7",$0020$)
rb7!.setCallback(rb7!.ON_CHECK_ON,"event")
rb7!.setCallback(rb7!.ON_CHECK_OFF,"event")
rb8! = window!.addRadioButton(108,200,100,150,25,"RadioButton8",$0020$)
rb8!.setCallback(rb8!.ON_CHECK_ON,"event")
rb8!.setCallback(rb8!.ON_CHECK_OFF,"event")
rg2! = window!.addRadioGroup()
rg2!.setName("RadioGroup2",err=*next)
rg2!.add(rb5!)
rg2!.add(rb6!)
rg2!.add(rb7!)
rg2!.add(rb8!)

rem ' This BBjRadioGroup event is available in BBj 23.
rg1!.setCallback(rg1!.ON_SELECTION_CHANGE,"group",err=*next)
rg2!.setCallback(rg2!.ON_SELECTION_CHANGE,"group",err=*next)
events! = window!.addCEdit(900,25,150,750,325,$$,$0184$)
process_events

eoj:
release

resize:
    event! = sysgui!.getLastEvent()
    width = event!.getWidth()
    height = event!.getHeight()
    events!.setSize(width-50,height-175)
return

event:
    event! = sysgui!.getLastEvent()
    msg$ = event!.getEventName()+" "+event!.getRadioButton().getText()
    msg$ = msg$ + " " + event!.getRadioButton().getRadioGroup().getName(err=*next)
    print msg$
    events!.addParagraph(-1,msg$)
    events!.highlight(-1,0,-1,0)
return

group:
    event! = sysgui!.getLastEvent()
    group! = event!.getRadioGroup()
    selected! = event!.getSelected()
    if selected!=null() then selected$ = "" else selected$ = selected!.getText()
    deselected! = event!.getDeselected()
    if deselected!=null() then deselected$ = "" else deselected$ = deselected!.getText()
    msg$ = event!.getEventName()+" "+group!.getName(err=*next)
    msg$ = msg$+" selected="+selected$+" deselected="+deselected$
    print msg$
    events!.addParagraph(-1,msg$)
    events!.highlight(-1,0,-1,0)
return

See Also

BBjAPI

BBjSysGui

BBjWindow

RADIOBUTTON Mnemonic - Create a Radio Button Control

RADIOGROUP Mnemonic - Create a Radio Button Group

CALLBACK Verb - Register BBj Subroutine

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