REM Add get selected radio button in a radio group
REM Obtain the instance of the BBjAPI object LET myAPI!=BBjAPI()
REM Open the SysGui device SYSGUI=UNT OPEN (SYSGUI) "X0"
REM Obtain the instance of the BBjSysGui object LET mySysGui!=myAPI!.getSysGui()
REM Set addWindow param values X=10 Y=10 WIDTH=200 HEIGHT=200 TITLE$="BBj Window"
REM Set the current context mySysGui!.setContext(0)
REM Create a window myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$)
REM Add the radio buttons on the window myRadioButton1! = myWindow!.addRadioButton(101,10,50,80,30,"Button &1",$0000$) myRadioButton2! = myWindow!.addRadioButton(102,10,100,80,30,"Button &2",$0000$) myRadioButton3! = myWindow!.addRadioButton(103,10,150,80,30,"Button &3",$0000$) myRadioButtonA! = myWindow!.addRadioButton(201,100,50,80,30,"Button &A",$0000$) myRadioButtonB! = myWindow!.addRadioButton(202,100,100,80,30,"Button &B",$0000$) myRadioButtonC! = myWindow!.addRadioButton(203,100,150,80,30,"Button &C",$0000$)
REM First method LET myVector!=myAPI!.makeVector()
REM add the buttons to the vector myVector!.addItem(myRadioButton1!) myVector!.addItem(myRadioButton2!) myVector!.addItem(myRadioButton3!)
REM add the grouping myRadioGroup1!=myWindow!.addRadioGroup(myVector!)
REM Second method myRadioGroup2!=myWindow!.addRadioGroup() myRadioGroup2!.add(myRadioButtonA!) myRadioGroup2!.add(myRadioButtonB!) myRadioGroup2!.add(myRadioButtonC!)
REM Register the CALLBACK routines CALLBACK(ON_CHECK_ON,RADIO_BUTTON_CHECKED,mySysGui!.getContext(),myRadioButton1!.getID()) CALLBACK(ON_CHECK_ON,RADIO_BUTTON_CHECKED,mySysGui!.getContext(),myRadioButton2!.getID()) CALLBACK(ON_CHECK_ON,RADIO_BUTTON_CHECKED,mySysGui!.getContext(),myRadioButton3!.getID()) CALLBACK(ON_CHECK_ON,RADIO_BUTTON_CHECKED,mySysGui!.getContext(),myRadioButtonA!.getID()) CALLBACK(ON_CHECK_ON,RADIO_BUTTON_CHECKED,mySysGui!.getContext(),myRadioButtonB!.getID()) CALLBACK(ON_CHECK_ON,RADIO_BUTTON_CHECKED,mySysGui!.getContext(),myRadioButtonC!.getID()) CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
REM Process Events PROCESS_EVENTS
REM Callback routine called when the radio button is checked RADIO_BUTTON_CHECKED: REM Display a message that the radio button is checked LET Selected1! = myRadioGroup1!.getSelected() IF Selected1! = null() then Selected1$ = "No button in the first group is selected"+$0a$ else Selected1$ = "Selected radio button in first group is "+Selected1!.getText()+$0a$ endif LET Selected2! = myRadioGroup2!.getSelected() IF Selected2! = null() then Selected2$ = "No button in the second group is selected"+$0a$ else Selected2$ = "Selected radio button in second group is "+Selected2!.getText()+$0a$ endif MESSAGE$="Checked "+mySysGui!.getLastEvent().getControl().getText()+$0a$+Selected1$+Selected2$ LET X=MSGBOX(MESSAGE$) RETURN
REM Callback routine called when the user closes the application window APP_CLOSE: RELEASE
|