-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmLogEdit.frm
300 lines (273 loc) · 9.09 KB
/
frmLogEdit.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmLogEdit
BorderStyle = 3 'Fixed Dialog
Caption = "Edit Log"
ClientHeight = 4410
ClientLeft = 45
ClientTop = 330
ClientWidth = 6450
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmLogEdit.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4410
ScaleWidth = 6450
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin MSComCtl2.DTPicker dteDate
Height = 315
Left = 4890
TabIndex = 3
Top = 1035
Width = 1365
_ExtentX = 2408
_ExtentY = 556
_Version = 393216
Format = 19791873
UpDown = -1 'True
CurrentDate = 37112
End
Begin VB.ComboBox lstModes
Height = 315
Left = 165
Style = 2 'Dropdown List
TabIndex = 1
Top = 1035
Width = 4485
End
Begin MSComCtl2.DTPicker dteTime
Height = 330
Left = 165
TabIndex = 5
Top = 1995
Width = 1365
_ExtentX = 2408
_ExtentY = 582
_Version = 393216
Format = 19791874
UpDown = -1 'True
CurrentDate = 37112
End
Begin HoursAndMinutes.ctlCommentEdit ctlComments
Height = 1470
Left = 1785
TabIndex = 7
Top = 1995
Width = 4470
_ExtentX = 7885
_ExtentY = 2593
End
Begin VB.CommandButton btnCancel
Cancel = -1 'True
Caption = "Cancel"
Height = 345
Left = 5130
TabIndex = 9
Top = 3900
Width = 1125
End
Begin VB.CommandButton btnOk
Caption = "OK"
Height = 345
Left = 3915
TabIndex = 8
Top = 3900
Width = 1125
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "Select a &date:"
Height = 195
Left = 4890
TabIndex = 2
Top = 825
Width = 1005
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "&Select a task:"
Height = 195
Left = 165
TabIndex = 0
Top = 825
Width = 975
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "&Comments:"
Height = 195
Left = 1785
TabIndex = 6
Top = 1785
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "&Time:"
Height = 195
Left = 165
TabIndex = 4
Top = 1785
Width = 390
End
Begin VB.Label Label1
Caption = "Select the task and date that you're interested in from the list && box below. You'll be asked to save any changes."
Height = 495
Left = 165
TabIndex = 10
Top = 150
Width = 6090
End
End
Attribute VB_Name = "frmLogEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public m_lngFocusModeID As Long
Private m_blnChanged As Boolean
Private m_lngCurrentMode As Long
Private m_dteCurrentDate As Date
Public m_blnCancelPressed As Boolean
Public Sub listModes()
Dim X As Long
lstModes.Clear
For X = 1 To m_colModes.Count
With m_colModes.Item(X)
lstModes.AddItem .m_strName
lstModes.ItemData(lstModes.ListCount - 1) = .m_lngID
If m_lngFocusModeID = .m_lngID Then
lstModes.ListIndex = lstModes.ListCount - 1
End If
End With
Next
GetData
End Sub
Private Sub saveCurrent()
Dim objReg As clsRegistry
Dim arrComments() As String, strComments As String
Dim strTemp As String
If m_blnChanged Then
strTemp = ""
If (m_lngCurrentMode = frmMain.m_lngActiveModeID) And (m_dteCurrentDate = frmMain.m_dteDate) Then
strTemp = vbCrLf & vbCrLf & "Note: Since this is the current task & date used, time will also be updated to the counter."
End If
If MsgBox("Do you want to save changes to the current date?" & strTemp, vbYesNo Or vbQuestion) = vbYes Then
arrComments = ctlComments.GetText
strComments = Join(arrComments, "*")
strComments = Left(strComments, InStrRev(strComments, "*"))
' check if current mode
If (m_lngCurrentMode = frmMain.m_lngActiveModeID) And (m_dteCurrentDate = frmMain.m_dteDate) Then
frmMain.m_lngStartTime = GetTickCount - GetMSeconds(dteTime.Value)
End If
' save to registry
Set objReg = New clsRegistry
With objReg
.ClassKey = HKEY_CURRENT_USER
.SectionKey = m_strRegRoot & "\Modes\" & m_lngCurrentMode
.ValueKey = "Date " & CLng(m_dteCurrentDate)
.Value = GetMSeconds(dteTime.Value)
.ValueKey = "Comment " & CLng(m_dteCurrentDate)
.Value = strComments
End With
Set objReg = Nothing
End If
m_blnChanged = False
End If
End Sub
Private Sub GetData()
Dim objReg As clsRegistry
Dim strComments As String, arrComments() As String
' check for changes to the current post
saveCurrent
Set objReg = New clsRegistry
With objReg
.ClassKey = HKEY_CURRENT_USER
.SectionKey = m_strRegRoot & "\Modes\" & lstModes.ItemData(lstModes.ListIndex)
.ValueKey = "Date " & CLng(dteDate.Value)
dteTime.Value = FormatMSeconds(CLng(.Value))
.ValueKey = "Comment " & CLng(dteDate.Value)
strComments = CStr(.Value)
If strComments <> "" Then
strComments = strComments & "<new comment>"
arrComments = Split(strComments, "*")
ctlComments.SetText arrComments
Else
arrComments = Split("<new comment>", "*")
ctlComments.SetText arrComments
End If
End With
Set objReg = Nothing
m_lngCurrentMode = lstModes.ItemData(lstModes.ListIndex)
m_dteCurrentDate = CDate(dteDate.Value)
End Sub
Private Sub btnCancel_Click()
Hide
End Sub
Private Sub btnOk_Click()
m_blnCancelPressed = False
saveCurrent
Hide
End Sub
Private Sub ctlComments_DblClick(strText As String, blnUpdate As Boolean, blnAddItem As Boolean)
If strText = "<new comment>" Then
Load frmModeComment
With frmModeComment
.txtValue.Text = ""
.Show 1, Me
If .m_blnCancelPressed = False Then
strText = .txtValue.Text
blnAddItem = True
m_blnChanged = True
End If
End With
Unload frmModeComment
Else
Load frmModeComment
With frmModeComment
.txtValue.Text = strText
.txtValue.SelStart = 0
.txtValue.SelLength = Len(strText)
.Show 1, Me
If .m_blnCancelPressed = False Then
strText = .txtValue.Text
blnUpdate = True
m_blnChanged = True
End If
End With
Unload frmModeComment
End If
End Sub
Private Sub ctlComments_Delete(strText As String, blnDelete As Boolean)
If strText = "<new comment>" Then Exit Sub
If MsgBox("Are you sure that you want to delete the selected comment?", vbYesNo Or vbQuestion) = vbYes Then
blnDelete = True
m_blnChanged = True
End If
End Sub
Private Sub dteDate_Change()
GetData
End Sub
Private Sub dteTime_Change()
m_blnChanged = True
End Sub
Private Sub Form_Load()
m_blnCancelPressed = True
dteDate.Value = Date
dteTime.Value = CDate(Date)
m_blnChanged = False
End Sub
Private Sub lstModes_Click()
GetData
End Sub