Hi,
I just tried the Option button's by adding 2 buttons to a form and setting the
2nd one Group=False. Below is the generated code.
It works for me - that is selecting a option button forces the other button to
unselect.
Cut and paste this code into a TEXT file and load it up in the editor and run
it. See if it works.
'*** Begin Generated Code ***
Form1_Show 'Default Form
Dim Form1_Temp
Sub Form1_Show
On Error Resume Next
UpdateScreen
If IsEmpty(Form1_Temp) Then
AddObject "Frame", "Form1_Form", 0, 0, Output.Width, Output.Height
Form1_Form.Visible = False
Form1_Form.BackColor = 12632256
AddObject "PictureBox", "Form1", 0, 0, 0, 0, Form1_Form
Form1.BorderStyle = 0
Form1.Move 0, 0, Form1_Form.Width * 15, Form1_Form.Height * 15
Set Form1_Temp = Form1
Form1_Form.Caption = "Form1"
AddObject "OptionButton", "OptionButton1", 27, 33, 92, 21, Form1_Form
OptionButton1.BackColor = 12632256
OptionButton1.Caption = "OptionButton1"
OptionButton1.FontSize = 8.25
'--------
AddObject "OptionButton", "OptionButton2", 32, 89, 92, 21, Form1_Form
OptionButton2.BackColor = 12632256
OptionButton2.Caption = "OptionButton2"
OptionButton2.FontSize = 8.25
OptionButton2.Group = False
'--------
End If
On Error Goto 0
Form1_Form.Visible = True
callIfExists("Form1_Load")
End Sub 'Form1_Show
Sub Form1_Hide
If IsEmpty(Form1_Temp) Then
Err.Raise 44000, , "Form not loaded"
Exit Sub
End If
Form1_Form.Visible = False
callIfExists("Form1_Unload")
End Sub 'Form1_Hide
Sub CallIfExists(theSub)
Dim s
If ScriptEngineMajorVersion < 5 Then
Execute("On Error Resume Next:"&theSub) 'attempt to execute it
Else
On Error Resume Next
Set s = GetRef(theSub)
If err.Number <> 0 Then Exit Sub 'it does not exist
On Error GoTo 0
Execute (theSub) 'execute it
End If
End Sub
'*** End Generated Code ***
--- In [email protected], "bwolodko" <ben.wolo...@...> wrote:
>
> --- In [email protected], "Randall Jones" <randalljones@> wrote:
> >
> > I'm beginning to take this personal.
> >
> > I am trying to create grouped optionbuttons. The language reference
> > says it goes like this.
> >
> > - Create the first button. Set the group property to true.
> > - Create the subsequent buttons group property to false.
> >
> > They will all be in the same group. Idea being that within that group
> > only 1 button can be set at a time. Clicking on a button will clear
> > any button already set.
> >
> > This is not happening for me. I can set all buttons no matter what.
> >
> > I'm doing something wrong. Somebody please tell me what it is.
> >
> > At your service ...
> >
> > Randall Jones
> > randalljones@
> > AE7RJ
> >
> > "We can't solve problems by using the same kind of thinking we used
> > when we created them."
> > --Albert Einstein (1879-1955)
> >
> Don't you just love programming with less than stellar examples ...
> especially when you are just learning as I am as well..
>
> I am developing for a CuWin3500 HMI device, having CE 5.0 in it.
>
> I posed a similar question a few weeks ago, and did not get any replys.
>
> I have the same issue, with Radio or Option Buttons.
>
> What I found was that I had to do the following
>
> Option Explicit
> Dim HoleType
>
> Sub OB1_Click
> HoleType="Mechanical"
> OB1.ForeColor = &H000000C0&
> OB1.Value = True
> OB2.Value = False
> OB2.ForeColor =&H00000000&
> OB3.Value = False
> OB3.ForeColor =&H00000000&
> OB4.Value = False
> OB4.ForeColor =&H00000000&
> End Sub
>
> Sub OB2_Click
> HoleType="Hand Hole"
> OB2.ForeColor =&H000000C0&
> OB2.Value = True
> OB1.Value = False
> OB1.ForeColor =&H00000000&
> OB3.Value = False
> OB3.ForeColor =&H00000000&
> OB4.Value = False
> OB4.ForeColor =&H00000000&
> End Sub
>
> etc for each radio button
>
> In essence, make one button's Value TRUE, and all the rest False
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nsb-ce" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---