-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathSetRange.frm
146 lines (132 loc) · 4.69 KB
/
SetRange.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
VERSION 5.00
Begin VB.Form frmSetValue
BorderStyle = 3 'Fixed Dialog
Caption = "Set Value"
ClientHeight = 1065
ClientLeft = 45
ClientTop = 330
ClientWidth = 3945
ClipControls = 0 'False
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1065
ScaleWidth = 3945
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Tag = "14500"
Begin VB.TextBox txtEndVal
Height = 285
Left = 1320
TabIndex = 3
Text = "5"
Top = 600
Width = 975
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "&Cancel"
Height = 375
Left = 2760
TabIndex = 5
Tag = "4020"
Top = 600
Width = 1095
End
Begin VB.CommandButton cmdSet
Caption = "&Set"
Default = -1 'True
Height = 375
Left = 2760
TabIndex = 4
Tag = "14510"
Top = 120
Width = 1095
End
Begin VB.TextBox txtStartVal
Height = 285
Left = 120
TabIndex = 1
Text = "5"
Top = 600
Width = 975
End
Begin VB.Label lblHiddenStatus
Caption = "Hidden Status"
Height = 255
Left = 120
TabIndex = 6
Top = 960
Visible = 0 'False
Width = 1335
End
Begin VB.Label lblEndVal
Caption = "End Val"
Height = 435
Left = 1320
TabIndex = 2
Top = 120
Width = 1215
End
Begin VB.Label lblStartVal
Caption = "Start Val"
Height = 435
Left = 120
TabIndex = 0
Top = 120
Width = 1035
End
End
Attribute VB_Name = "frmSetValue"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private blnCoerceDataWithinLimits As Boolean
Private mLowerLimit As Double
Private mUpperLimit As Double
Private localDefaultSeparationValue As Double
Public Sub SetLimits(blbLclCoerceDataWithinLimits As Boolean, Optional dblLowerLimit As Double = 0, Optional dblUpperLimit As Double = 100, Optional dblDefaultSeparationValue As Double = 1)
blnCoerceDataWithinLimits = blbLclCoerceDataWithinLimits
If blbLclCoerceDataWithinLimits Then
mLowerLimit = dblLowerLimit
mUpperLimit = dblUpperLimit
localDefaultSeparationValue = dblDefaultSeparationValue
End If
End Sub
Private Sub cmdCancel_Click()
lblHiddenStatus = "Cancel"
Me.Hide
End Sub
Private Sub cmdSet_Click()
' Must re-validate data since data is not validated if user presses Enter after changing a value
If blnCoerceDataWithinLimits Then
ValidateDualTextBoxes txtStartVal, txtEndVal, False, CDbl(mLowerLimit), CDbl(mUpperLimit), CDbl(localDefaultSeparationValue)
End If
lblHiddenStatus = "Ok"
Me.Hide
End Sub
Private Sub Form_Load()
SizeAndCenterWindow Me, cWindowUpperThird, , , False
cmdSet.Caption = LookupLanguageCaption(14510, "&Set")
cmdCancel.Caption = LookupLanguageCaption(4020, "&Cancel")
Me.Caption = LookupLanguageCaption(14500, "Set Value")
End Sub
Private Sub txtEndVal_KeyPress(KeyAscii As Integer)
TextBoxKeyPressHandler txtEndVal, KeyAscii, True, True, True, False, False, False, False, False, False, True, True
End Sub
Private Sub txtEndVal_Validate(Cancel As Boolean)
If blnCoerceDataWithinLimits Then
ValidateDualTextBoxes txtEndVal, txtEndVal, False, CDbl(mLowerLimit), CDbl(mUpperLimit), CDbl(localDefaultSeparationValue)
End If
End Sub
Private Sub txtStartVal_KeyPress(KeyAscii As Integer)
TextBoxKeyPressHandler txtStartVal, KeyAscii, True, True, True, False, False, False, False, False, False, True, True
End Sub
Private Sub txtStartVal_Validate(Cancel As Boolean)
If blnCoerceDataWithinLimits Then
ValidateDualTextBoxes txtStartVal, txtEndVal, False, CDbl(mLowerLimit), CDbl(mUpperLimit), CDbl(localDefaultSeparationValue)
End If
End Sub