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")
rb1!.setCallback(rb1!.ON_CHECK_CHANGE,"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")
rb2!.setCallback(rb2!.ON_CHECK_CHANGE,"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")
rb3!.setCallback(rb3!.ON_CHECK_CHANGE,"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")
rb4!.setCallback(rb4!.ON_CHECK_CHANGE,"event")
rg1! = window!.addRadioGroup()
rg1!.setName("RadioGroup1")
print "rg1!.getName()=",rg1!.getName()
rg1!.add(rb1!)
rg1!.add(rb2!)
rg1!.add(rb3!)
rg1!.add(rb4!)
rg1!.setCallback(rg1!.ON_SELECTION_CHANGE,"group")
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")
rb5!.setCallback(rb5!.ON_CHECK_CHANGE,"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")
rb6!.setCallback(rb6!.ON_CHECK_CHANGE,"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")
rb7!.setCallback(rb7!.ON_CHECK_CHANGE,"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")
rb8!.setCallback(rb8!.ON_CHECK_CHANGE,"event")
rg2! = window!.addRadioGroup()
rg2!.setName("RadioGroup2")
print "rg2!.getName()=",rg2!.getName()
rg2!.add(rb5!)
rg2!.add(rb6!)
rg2!.add(rb7!)
rg2!.add(rb8!)
rg2!.setCallback(rg2!.ON_SELECTION_CHANGE,"group")
rem ' Filter events
on! = window!.addCheckBox(109,400,25,300,25,"ON_CHECK_ON",$0004$)
off! = window!.addCheckBox(110,400,50,300,25,"ON_CHECK_OFF",$0004$)
change! = window!.addCheckBox(111,400,75,300,25,"ON_CHECK_CHANGE",$0000$)
selection! = window!.addCheckBox(112,400,100,300,25,"ON_SELECTION_CHANGE",$0000$)
reset! = window!.addButton(2,600,25,150,25,"Reset",$$)
reset!.setCallback(reset!.ON_BUTTON_PUSH,"reset")
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()
event$ = event!.getEventName()
switch event$
case "BBjCheckOnEvent"
event = on!.isSelected(); break
case "BBjCheckOffEvent"
event = off!.isSelected(); break
case "BBjCheckChangeEvent"
event = change!.isSelected(); break
case "BBjSelectionChangeEvent"
event = selection!.isSelected(); break
case default
event = 1
swend
if !event then return
msg$ = event$ + " " + event!.getRadioButton().getText()
msg$ = msg$ + " " + event!.getRadioButton().getRadioGroup().getName(err=*next)
msg$ = msg$ + " checked=" + Boolean.toString(event!.isChecked(err=*next))
print msg$
events!.addParagraph(-1,msg$)
events!.highlight(-1,0,-1,0)
return
group:
if !selection!.isSelected() then return
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
reset:
events!.setText("")
return
|