-- JochenGeorges - 18 Dec 2004

# How to organize groups of radiobuttons

Radiobuttons can be organized in independent groups.
Each Radiobutton has got a group-property which can be
set in the property-editor.
Remember: In a group of radiobuttons only one can be enabled!

## The Program

If a radiobutton is enabled a message shows which one is enabled.
The constructor _new() enables two radiobuttons at starttime.
Do not be confused by the name and the text of the radiobuttons!
There is only one, which is called radiobutton1, but two with this text!
The two groups are called Radio1 and Radio2.
This groups have got own methods like the method click(),
so you do not have to handle 8 single radiobuttons but only the two groups!

## The Code:

    STATIC PUBLIC SUB Main()
      DIM hForm AS Form
      hForm = NEW FTest
      hForm.Show
    END

    PUBLIC SUB _new()
      Radiobutton1.Value = TRUE
      Radiobutton8.Value = TRUE
    END

    PUBLIC SUB Radio1_Click()
      Message.Info("Radio 1 : " & LAST.Text)

'LAST returns a reference to the last
'object that raised an event
'see gambas-language-encyclopaedia

    END

    PUBLIC SUB Radio2_Click()
      Message.Info("Radio2 : " & LAST.Text)
    END

Attachment: | Action: | Size: | Date: | Who: | Comment:
--- | --- | --- | --- | --- | ---
message.png | action | 3174 | 18 Dec 2004 - 13:27 | JochenGeorges |
radiobuttongroup.png | action | 4763 | 18 Dec 2004 - 13:28 | JochenGeorges |
src-radiobuttongroup.tgz | action | 2130 | 18 Dec 2004 - 13:28 | JochenGeorges |