--- In [email protected], "Randall Jones" <randalljo...@...> 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
> randalljo...@...
> 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
In my case I also wanted to change the color of the Text of the button to show
that it was picked.
The problems I found were that the radio button, the Solid Dot and the circle
around it, did not increase in size as my text font, or size of the total
button increased in size, and you have to pick the Dot/Circle to activate the
button, not the body of the text.
For 39 radio buttons, I ended up with 1289 lines of Code, for 4 forms of
buttons.
My second approach was to use the following:
Option Explicit
ShowOKButton True 'Set minimize button URHC to close app
' make full screen hide taskbar and top menu
Dim hWnd
Dim nWidth
Dim nHeight
Dim bRepaint
Declare "Function GetForegroundWindow Lib ""Coredll"" () As Long"
Declare "Function MoveWindow Lib ""Coredll"" (ByVal hWnd As Long, ByVal x As
Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal
bRepaint As Long) As Long"
hWnd = GetForegroundWindow
' MoveWindow hWnd, 0, -26, Output.Width, Output.Height + 78, True ' was 52, 26
try real height at 480 add 26 for 506
MoveWindow hWnd, 0, -26, Output.Width, 506, True
'' need To hide the taskbar On Cuwin using a mouse in the USB port
Form1_Show
Dim DrlB(40)
Dim DrlR(40)
Dim BarC(10)
Dim HoleT(10)
Dim NHole(15)
Dim ChrgS(30)
Dim Pic(40)
Dim X, Y, I, J, K, L, M
Dim picName
Dim Frm
Dim DrillDepth
Dim strDepth
Dim DrlRH
Dim PathSD
PathSD = "\Storage Card\Drill Depth Buttons\"
DrlB(1) = "0_50B.bmp"
DrlR(1) = "0_50R.bmp"
DrlB(2) = "1_00B.bmp"
' the rest of the DrlB(3) = "1_50B.bmp" list
Frm = 0
For I = 1 To 10
If I <= 4 Then
X = 20
Y = 75 + (( I-1)*100)
End If
If (I > 4) And (I <=8) Then
X = 250
Y = 75 + (( I-5)*100)
End If
If (I > 8) And (I <=10) Then
X = 480
Y = 75 + (( I-9)*100)
End If
picName = "pic" & CStr(I)
AddObject "NSCEPictureBox.NSCEPictureBoxCtrl.1",picName,X,Y,220,90
Execute picName & ".ScaleMode = 3" ' pixels
Execute picName & ".BorderStyle = 0" ' none
Execute picName & ".Picture = PathSD & DrlB(I)"
Next
Sub pic1_Click
DrillDepth = Frm + 1
pic1.Picture = PathSD & DrlR(Frm + 1)
pic2.Picture = PathSD & DrlB(Frm + 2)
pic3.Picture = PathSD & DrlB(Frm + 3)
pic4.Picture = PathSD & DrlB(Frm + 4)
pic5.Picture = PathSD & DrlB(Frm + 5)
pic6.Picture = PathSD & DrlB(Frm + 6)
pic7.Picture = PathSD & DrlB(Frm + 7)
pic8.Picture = PathSD & DrlB(Frm + 8)
pic9.Picture = PathSD & DrlB(Frm + 9)
pic10.Picture = PathSD & DrlB(Frm + 10)
strDepth = FormatNumber(DrillDepth/2, 2, True)
TextBox_1.Text = "You have Picked a Drill Depth of "
TextBox_2.Text = strDepth & " Meters"
End Sub
Sub pic2_Click
DrillDepth = Frm + 2
pic1.Picture = PathSD & DrlB(Frm + 1)
pic2.Picture = PathSD & DrlR(Frm + 2)
pic3.Picture = PathSD & DrlB(Frm + 3)
pic4.Picture = PathSD & DrlB(Frm + 4)
pic5.Picture = PathSD & DrlB(Frm + 5)
pic6.Picture = PathSD & DrlB(Frm + 6)
pic7.Picture = PathSD & DrlB(Frm + 7)
pic8.Picture = PathSD & DrlB(Frm + 8)
pic9.Picture = PathSD & DrlB(Frm + 9)
pic10.Picture = PathSD & DrlB(Frm + 10)
strDepth = FormatNumber(DrillDepth/2, 1, True)
TextBox_1.Text = "You have Picked a Drill Depth of "
TextBox_2.Text = strDepth & " Meters"
End Sub
In this case I have one form, and 10 picture buttons, that I populate based on
what page I want to display.
Four pages of of 10 buttons each, in 420 lines of code
The picture buttons were created using "Easy Button Creator 2.0" and stored on
the SD card
http://www.easyimagetools.com/products/button/index.htm
The picture buttons, are activated by touching any part of the button.
The CuWin3500 has a touch screen, hense the large buttons. The final
application has to be capable with the use of gloves or big fingers.
Hope this helps.
NSBasic has its quirks, and I am just a beginner as well, but so far it's a
pretty good programming environment. I would be great if there were more
tutorials for beginners.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---