Radio Buttons simple example

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Radio Buttons simple example

Post by DiddeLeeDoo »

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
Last edited by DiddeLeeDoo on Mon Mar 05, 2007 4:22 am, edited 1 time in total.
Image
Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo »

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