Radio Buttons simple example

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Radio Buttons simple example

by Pablo » Sat Oct 07, 2006 2:04 am

Thanks, these types of examples are always useful :D .

Radio Buttons simple example

by DiddeLeeDoo » Thu Oct 05, 2006 5:42 am

I was bored for a minute and just made a little radio button example.

Totally useless script, but might help 1 person to get to understand that one.

There is two 'radio stations' with three buttons each

Image

Code: Select all

Set SDB=CreateObject("SongsDB.SDBApplication")

'Make a Form frame
Set Frm=SDB.UI.NewForm
    Frm.Common.SetRect 0,0,220,160


'---------------------
'RADIO STATION 1
Set Pnl=SDB.UI.NewTranspPanel(Frm)
    Pnl.Common.SetRect 10,10,100,100
    Pnl.Common.ControlName="RadioStation1"

'RadioButtons for Station 1 
Set Rad=SDB.UI.NewRadioButton(Pnl)
    Rad.Common.SetRect 10,10,60,20
    Rad.Caption="Station 1"
    Rad.Checked=True
    Rad.Common.ControlName="R01"
Set Rad=SDB.UI.NewRadioButton(Pnl)
    Rad.Common.SetRect 10,30,60,20
    Rad.Caption="Station 2"
    Rad.Checked=False
    Rad.Common.ControlName="R02"
Set Rad=SDB.UI.NewRadioButton(Pnl)
    Rad.Common.SetRect 10,50,60,20
    Rad.Caption="Station 3"
    Rad.Checked=False
    Rad.Common.ControlName="R03"

'-------------    
'RADIO STATION 2
Set Pnl=SDB.UI.NewTranspPanel(Frm)
    Pnl.Common.SetRect 110,10,100,100
    Pnl.Common.ControlName="RadioStation2"

'RadioButtons for Station 2
Set Rad=SDB.UI.NewRadioButton(Pnl)
    Rad.Common.SetRect 10,10,60,20
    Rad.Caption="Station 1"
    Rad.Checked=True
    Rad.Common.ControlName="R01"
Set Rad=SDB.UI.NewRadioButton(Pnl)
    Rad.Common.SetRect 10,30,60,20
    Rad.Caption="Station 2"
    Rad.Checked=False
    Rad.Common.ControlName="R02"
Set Rad=SDB.UI.NewRadioButton(Pnl)
    Rad.Common.SetRect 10,50,60,20
    Rad.Caption="Station 3"
    Rad.Checked=False
    Rad.Common.ControlName="R03"
    
'Show form
Frm.ShowModal

'Read values from the form.
If Frm.Common.ChildControl("RadioStation1").Common.ChildControl("R01").Checked Then Station1=1
If Frm.Common.ChildControl("RadioStation1").Common.ChildControl("R02").Checked Then Station1=2
If Frm.Common.ChildControl("RadioStation1").Common.ChildControl("R03").checked Then Station1=3

If Frm.Common.ChildControl("RadioStation2").Common.ChildControl("R01").Checked Then Station2=1
If Frm.Common.ChildControl("RadioStation2").Common.ChildControl("R02").Checked Then Station2=2
If Frm.Common.ChildControl("RadioStation2").Common.ChildControl("R03").checked Then Station2=3

'tell what you selected after closing the form
MsgBox Station1 & vbLf & Station2

Top