Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: HimyKabibble on March 29, 2009, 12:04:00 PM
-
I'm screwing around with VB and dialogs, but can't seem to get reading and writing TextBox controls to work. My code is below. It appears to me I *should* be able to write to the TextBox control with:
Dlg1.VFDFreq = "abcd" or, perhaps Dlg1.VFDFreq.Text = "abcd"
Both throw syntax errors. What am I doing wrong?
Regards,
Ray L.
' Spindle Speed Calculator
Sub Main
Begin Dialog BoxSample 16,35,256,89,"Motor Speed Calculator", .OnAction
CancelButton 204,44,40,14
Text 12,12,64,8,"Target Speed:"
TextBox 16,24,32,10, .TargetSpeed
Text 130,12, 50, 8,"VFDFreq:"
TextBox 130, 24, 50, 10, .VFDFreq
End Dialog
Dim Dlg1 As BoxSample
Button = Dialog ( Dlg1 )
End Sub
Function OnAction( ControlID$, Action%, SuppValue% )
Dlg1.VFDFreq.Text("ABCD")
Select Case Action%
Case 1
Case 2
If ControlID$ = "TargetSpeed" Then
Dlg1.VFDFreq.Text = "1234"
End If
Case Else
End Select
End Function
-
Hmmmmm.... This is interesting as well. The Cypress documentation says Action 3 does:
"Action 3 Corresponds to a change in a text box or combo box. This value is passed when a control loses the focus (for example, when the user presses the TAB key to move to a different control) or after the user clicks an item in the list of a combo box (an Action value of 2 is passed first). Note that if the contents of the text box or combo box do not change, an Action value of 3 is not passed."
But, Action 3 actually occurs on *every* keystroke entered into a TextBox....
Regards,
Ray L.
-
OK, I seem to be able to set control values with DlgText, and it looks like DlgValue should get a controls value, but all I can read is zeroes....
Regards,
Ray L.