source: cprs/trunk/CPRS-Chart/Orders/fOtherSchedule.pas@ 908

Last change on this file since 908 was 829, checked in by Kevin Toppenberg, 14 years ago

Upgrade to version 27

File size: 19.8 KB
Line 
1unit fOtherSchedule;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, ComCtrls, StdCtrls, ExtCtrls, Buttons, fAutoSz, rMisc, ORCtrls, rODMeds,
8 VA508AccessibilityManager, VAUtils;
9
10const
11 NSS_TXT = 'This order will not become active until a valid schedule is used.';
12
13type
14 TfrmOtherSchedule = class(TfrmAutoSz)
15 Panel1: TPanel;
16 Image1: TImage;
17 Panel3: TPanel;
18 GroupBox1: TGroupBox;
19 cbo7: TCheckBox;
20 cbo1: TCheckBox;
21 cbo2: TCheckBox;
22 cbo3: TCheckBox;
23 cbo4: TCheckBox;
24 cbo5: TCheckBox;
25 cbo6: TCheckBox;
26 GroupBox2: TGroupBox;
27 lstHour: TListBox;
28 lstMinute: TListBox;
29 Panel4: TPanel;
30 btn0k1: TButton;
31 btnCancel: TButton;
32 Label1: TLabel;
33 btnReset: TButton;
34 btnRemove: TButton;
35 memMessage: TMemo;
36 Splitter1: TSplitter;
37 btnAdd: TButton;
38 Button1: TButton;
39 GroupBox3: TGroupBox;
40 NSScboSchedule: TORComboBox;
41 btnSchAdd: TButton;
42 btnSchRemove: TButton;
43 txtSchedule: TEdit;
44 procedure FormCreate(Sender: TObject);
45 procedure btnCancelClick(Sender: TObject);
46 procedure btn0k1Click(Sender: TObject);
47 procedure cbo7Click(Sender: TObject);
48 procedure cbo1Click(Sender: TObject);
49 procedure cbo2Click(Sender: TObject);
50 procedure cbo3Click(Sender: TObject);
51 procedure cbo4Click(Sender: TObject);
52 procedure cbo5Click(Sender: TObject);
53 procedure cbo6Click(Sender: TObject);
54 procedure btnAddClick(Sender: TObject);
55 procedure btnResetClick(Sender: TObject);
56 procedure btnRemoveClick(Sender: TObject);
57 procedure FormClose(Sender: TObject; var Action: TCloseAction);
58 procedure lstHourClick(Sender: TObject);
59 procedure txtScheduleChange(Sender: TObject);
60 procedure lstMinuteMouseUp(Sender: TObject; Button: TMouseButton;
61 Shift: TShiftState; X, Y: Integer);
62 procedure lstMinuteKeyDown(Sender: TObject; var Key: Word;
63 Shift: TShiftState);
64 procedure Button1Click(Sender: TObject);
65 procedure btnSchAddClick(Sender: TObject);
66 procedure btnSchRemoveClick(Sender: TObject);
67 procedure FormDestroy(Sender: TObject);
68 private
69 FDaySchedule: array [1..7] of string;
70 FTimeSchedule: TStringList;
71 FSchedule: String;
72 FOtherSchedule: String;
73 FFromCheckBox: boolean;
74 FFromEditBox: boolean;
75 function GetSiteMessage: string;
76 procedure SetDaySchedule(Sender: TObject);
77 procedure SetTimeSchedule;
78 procedure SetScheduleSelection;
79 procedure UpdateOnFreeTextInput;
80 procedure EnabledTime(TF: boolean);
81 procedure EnabledSch(TF: boolean);
82 function CheckDay(ADayStr: string): string;
83
84 public
85 end;
86
87function ShowOtherSchedule(var ASchedule: string): boolean;
88
89var
90 frmOtherSchedule: TfrmOtherSchedule;
91
92implementation
93
94uses ORFn, ORNet, rOrders;
95{$R *.dfm}
96
97function ShowOtherSchedule(var ASchedule: string):
98
99boolean;
100var
101
102 AdminTime, SchType: string;
103begin
104 Result := False;
105 try
106 ASchedule := '';
107 frmOtherSchedule := TfrmOtherSchedule.Create(Application);
108 ResizeFormToFont(TForm(frmOtherSchedule));
109 SetFormPosition(frmOtherSchedule);
110 if frmOtherSchedule.ShowModal = mrOK then
111 begin
112 ASchedule := UpperCase(frmOtherSchedule.FOtherSchedule);
113 if frmOtherSchedule.GroupBox3.Enabled = True then
114 begin
115 AdminTime := Piece(frmOtherSchedule.NSScboSchedule.Items.Strings[frmOtherSchedule.NSScboSchedule.itemindex],U,4);
116 schType := Piece(frmOtherSchedule.NSScboSchedule.Items.Strings[frmOtherSchedule.NSScboSchedule.itemindex],U,3);
117 ASchedule := ASchedule + U + AdminTime + U + schType;
118 //if (schType = 'P') or (schType = 'OC') then ASchedule := ASchedule + U + '1'
119 //else ASchedule := ASchedule + U + '0';
120 end
121 else if frmOtherSchedule.GroupBox2.Enabled = true then
122 begin
123 AdminTime := Piece(ASchedule,'@',2);
124 ASchedule := ASchedule + U + AdminTime + U + 'C';
125 end;
126 Result := True;
127 end;
128 except
129 ShowMsg('Error happen when building other schedule');
130 end;
131end;
132
133
134procedure TfrmOtherSchedule.FormCreate(Sender: TObject);
135var
136 i: integer;
137 nssMsg: string;
138begin
139 frmOtherSchedule := nil;
140 FFromCheckBox := False;
141 FFromEditBox := False;
142 image1.Picture.Icon.Handle := LoadIcon(0, IDI_WARNING);
143 for i := 1 to 7 do
144 FDaySchedule[i] := '';
145 FTimeSchedule := TStringlist.Create;
146 FSchedule := '';
147 FOtherSchedule := '';
148 nssMsg := GetSiteMessage;
149 if Length(nssMsg)< 1 then
150 nssMsg := NSS_TXT;
151 memMessage.Lines.Add(nssMsg);
152 LoadDOWSchedules(NSScboSchedule.Items);
153 if ScreenReaderActive = false then txtSchedule.TabStop := false;
154
155end;
156
157procedure TfrmOtherSchedule.FormDestroy(Sender: TObject);
158begin
159 inherited;
160 //FDaySchedule
161 FTimeSchedule.Free;
162 frmOtherSchedule := nil;
163 //FSchedule: String;
164 //FOtherSchedule: String;
165end;
166
167procedure TfrmOtherSchedule.btnCancelClick(Sender: TObject);
168begin
169 frmOtherSchedule.Release;
170end;
171
172procedure TfrmOtherSchedule.btn0k1Click(Sender: TObject);
173begin
174 if (cbo1.Checked = false) and (cbo2.Checked = false) and (cbo3.Checked = false) and (cbo4.Checked = false) and (cbo5.Checked = false) and
175 (cbo6.Checked = false) and (cbo7.Checked = false) then
176 begin
177 ShowMsg('A day of week must be selected!');
178 Exit;
179 end;
180 if Pos('@', self.txtSchedule.Text) = 0 then
181 begin
182 ShowMsg('An Administation Time or a schedule needs to be selected');
183 exit;
184 end;
185(* if not IsValidSchStr(FOtherSchedule) then
186 begin
187 Show508Message('The schedule you entered is invalid!');
188 Exit;
189 end; *)
190 modalResult := mrOK;
191end;
192
193procedure TfrmOtherSchedule.SetDaySchedule(Sender: TObject);
194var
195 i : integer;
196 TimePart, DayPart, Schedule: string;
197begin
198 with (Sender as TCheckBox) do
199 begin
200 try
201 if TCheckBox(Sender).Checked then
202 FDaySchedule[TCheckBox(Sender).Tag] := Copy(TCheckBox(Sender).Caption,0,2)
203 else
204 FDaySchedule[TCheckBox(Sender).Tag] := '';
205 except
206 ShowMsg('Error happened when building day schedule.');
207 Exit;
208 end;
209 end;
210
211 TimePart := '';
212 DayPart := '';
213 schedule := '';
214 if Self.GroupBox2.Enabled = True then
215 begin
216 for i := 0 to FTimeSchedule.Count - 1 do
217 begin
218 if i = 0 then TimePart := TimePart + FTimeSchedule[i]
219 else TimePart := TimePart + '-' + FTimeSchedule[i];
220 end;
221 end;
222 if (self.GroupBox3.Enabled = True) and (FSchedule <> '') then schedule := FSchedule;
223 for i := Low(FDaySchedule) to High(FDaySchedule) do
224 begin
225 if Length(FDaySchedule[i])>0 then
226 begin
227 if DayPart = '' then DayPart := FDaySchedule[i]
228 else DayPart := DayPart + '-' + FDaySchedule[i];
229 end;
230 end;
231 if Length(TimePart) > 0 then
232 begin
233 if Length(DayPart) > 0 then
234 FOtherSchedule := DayPart + '@' + TimePart
235 else if Length(DayPart) = 0 then
236 FOtherSchedule := TimePart;
237 end
238 else if Length(schedule) > 0 then
239 begin
240 if length(DayPart) > 0 then
241 FOtherSchedule := DayPart + '@' + Schedule
242 else if Length(DayPart) = 0 then
243 FOtherSchedule := Schedule;
244 end
245 else FOtherSchedule := DayPart;
246 txtSchedule.Text := FOtherSchedule;
247end;
248
249
250procedure TfrmOtherSchedule.SetScheduleSelection;
251var
252 i: integer;
253 DayPart: string;
254begin
255 DayPart := '';
256 for i := Low(FDaySchedule) to High(FDaySchedule) do
257 begin
258 if Length(FDaySchedule[i])>0 then
259 begin
260 if DayPart = '' then DayPart := FDaySchedule[i]
261 else DayPart := DayPart + '-' + FDaySchedule[i];
262 end;
263 end;
264 if Length(DayPart) > 0 then
265 begin
266 if FSchedule <> '' then
267 FOtherSchedule := DayPart + '@' + FSchedule
268 else
269 FOtherSchedule := DayPart;
270 end
271 else FOtherSchedule := FSchedule;
272 //if Length(APRN) > 0 then FOtherSchedule := FOtherSchedule;
273 txtSchedule.Text := FOtherSchedule;
274end;
275
276procedure TfrmOtherSchedule.SetTimeSchedule;
277var
278 i : integer;
279 TimePart, DayPart,APRN,ASearchTxt: string;
280begin
281 TimePart := '';
282 DayPart := '';
283 APRN := '';
284 ASearchTxt := UpperCase(txtSchedule.Text);
285 if StrPos(PChar(ASearchTxt),PChar('PRN')) <> nil then APRN := ' PRN'; //hds8326 retain PRN free text if data time entered
286 for i := 0 to FTimeSchedule.Count - 1 do
287 begin
288 if i = 0 then TimePart := TimePart + FTimeSchedule[i]
289 else TimePart := TimePart + '-' + FTimeSchedule[i];
290 end;
291 for i := Low(FDaySchedule) to High(FDaySchedule) do
292 begin
293 if Length(FDaySchedule[i])>0 then
294 begin
295 if DayPart = '' then DayPart := FDaySchedule[i]
296 else DayPart := DayPart + '-' + FDaySchedule[i];
297 end;
298 end;
299 if Length(DayPart) > 0 then
300 begin
301 if Length(TimePart) > 0 then
302 FOtherSchedule := DayPart + '@' + TimePart
303 else
304 FOtherSchedule := DayPart;
305 end
306 else FOtherSchedule := TimePart;
307 if Length(APRN) > 0 then FOtherSchedule := FOtherSchedule + APRN; //hds8326 retain PRN free text if data time entered
308 txtSchedule.Text := FOtherSchedule;
309end;
310
311procedure TfrmOtherSchedule.cbo7Click(Sender: TObject);
312begin
313 FFromCheckBox := True;
314 if not FFromEditBox then
315 SetDaySchedule(Sender);
316 FFromCheckBox := False;
317end;
318
319procedure TfrmOtherSchedule.cbo1Click(Sender: TObject);
320begin
321 FFromCheckBox := True;
322 if not FFromEditBox then
323 SetDaySchedule(Sender);
324 FFromCheckBox := False;
325end;
326
327procedure TfrmOtherSchedule.cbo2Click(Sender: TObject);
328begin
329 FFromCheckBox := True;
330 if not FFromEditBox then
331 SetDaySchedule(Sender);
332 FFromCheckBox := False;
333end;
334
335procedure TfrmOtherSchedule.cbo3Click(Sender: TObject);
336begin
337 FFromCheckBox := True;
338 if not FFromEditBox then
339 SetDaySchedule(Sender);
340 FFromCheckBox := False;
341end;
342
343procedure TfrmOtherSchedule.cbo4Click(Sender: TObject);
344begin
345 FFromCheckBox := True;
346 if not FFromEditBox then
347 SetDaySchedule(Sender);
348 FFromCheckBox := False;
349end;
350
351procedure TfrmOtherSchedule.cbo5Click(Sender: TObject);
352begin
353 FFromCheckBox := True;
354 if not FFromEditBox then
355 SetDaySchedule(Sender);
356 FFromCheckBox := False;
357end;
358
359procedure TfrmOtherSchedule.cbo6Click(Sender: TObject);
360begin
361 FFromCheckBox := True;
362 if not FFromEditBox then
363 SetDaySchedule(Sender);
364 FFromCheckBox := False;
365end;
366
367procedure TfrmOtherSchedule.btnAddClick(Sender: TObject);
368var
369 hour, min: string;
370begin
371 if FSchedule <> '' then Exit;
372 if lstHour.ItemIndex < 0 then exit;
373 hour := lstHour.Items[lstHour.ItemIndex];
374 hour := Trim(Copy(hour,1,3));
375 if length(Trim(hour)) = 1 then
376 hour := '0' + Trim(hour);
377 if lstMinute.ItemIndex >= 0 then
378 begin
379 min := lstMinute.Items[lstMinute.itemIndex];
380 min := Copy(min,2,2);
381 end;
382 if min = '' then min := '00';
383 if (hour='00') and (min='00') then hour := '24';
384 if FTimeSchedule.IndexOf(hour)>=0 then
385 begin
386 FTimeSchedule[FTimeSchedule.IndexOf(hour)] := hour + min;
387 end;
388 if FTimeSchedule.IndexOf(hour+min) < 0 then
389 FTimeSchedule.Add(hour+min);
390 FTimeSchedule.Sort;
391 SetTimeSchedule;
392 if FTimeSchedule.Count > 0 then EnabledSch(False);
393end;
394
395procedure TfrmOtherSchedule.btnResetClick(Sender: TObject);
396var
397 i : integer;
398begin
399 cbo1.Checked := false;
400 cbo2.Checked := false;
401 cbo3.Checked:= false;
402 cbo4.Checked := false;
403 cbo5.Checked := false;
404 cbo6.Checked := false;
405 cbo7.Checked := false;
406 lstHour.ItemIndex := -1;
407 lstMinute.ItemIndex := -1;
408 NSScboSchedule.ItemIndex := -1;
409 for i := low(FDaySchedule) to high(FDaySchedule) do
410 FDaySchedule[i] := '';
411 FTimeSchedule.Clear;
412 FOtherSchedule := '';
413 txtSchedule.Text := '';
414 FSchedule := '';
415 EnabledTime(True);
416 EnabledSch(True);
417end;
418
419procedure TfrmOtherSchedule.btnSchAddClick(Sender: TObject);
420begin
421 inherited;
422 if self.NSScboSchedule.ItemIndex < 0 then Exit;
423 if FSchedule <> '' then
424 begin
425 infoBox('A Day-of-week schedule can only contain one schedule','Warning',MB_OK);
426 Exit;
427 end;
428 FSchedule := self.NSScboSchedule.Text;
429 SetScheduleSelection;
430 Self.NSScboSchedule.Enabled := False;
431 EnabledTime(False);
432end;
433
434procedure TfrmOtherSchedule.btnSchRemoveClick(Sender: TObject);
435begin
436 inherited;
437 if (FSchedule = '') or (self.NSScboSchedule.ItemIndex < 0) then exit;
438 if self.NSScboSchedule.Text <> FSchedule then exit;
439 Fschedule := '';
440 SetScheduleSelection;
441 self.NSScboSchedule.Enabled := True;
442 EnabledTime(True);
443end;
444
445procedure TfrmOtherSchedule.btnRemoveClick(Sender: TObject);
446var
447 hour, min: string;
448 idx : integer;
449begin
450 FFromCheckBox := True;
451 if lstHour.ItemIndex >= 0 then
452 begin
453 hour := lstHour.Items[lstHour.ItemIndex];
454 hour := Trim(Copy(hour,1,3));
455 if length(hour) = 1 then
456 hour := '0' + Trim(hour);
457 end;
458 if lstMinute.ItemIndex >= 0 then
459 begin
460 min := lstMinute.Items[lstMinute.itemIndex];
461 min := Copy(min,2,2);
462 end;
463 if min = '' then min := '00';
464 if (hour='00') and (min='00') then hour := '24';
465 idx := FTimeSchedule.IndexOf(hour+min);
466 if idx > -1 then
467 FTimeSchedule.Delete(idx);
468 FTimeSchedule.Sort;
469 SetTimeSchedule;
470 FFromCheckBox := False;
471 if FTimeSchedule.Count = 0 then EnabledSch(True);
472end;
473
474function TfrmOtherSchedule.GetSiteMessage: string;
475var
476 i: integer;
477 rstStr: string;
478begin
479 rstStr := '';
480 CallV('ORWNSS NSSMSG',[nil]);
481 for i := 0 to RPCBrokerV.Results.Count - 1 do
482 rstStr := rstStr + RPCBrokerV.Results[i];
483 Result := rstStr;
484end;
485
486procedure TfrmOtherSchedule.FormClose(Sender: TObject;
487 var Action: TCloseAction);
488begin
489 try
490 inherited;
491 SaveUserBounds(Self);
492 Action := caFree;
493 except
494 Action := caFree;
495 end;
496 //frmOtherSchedule := nil;
497end;
498
499procedure TfrmOtherSchedule.UpdateOnFreeTextInput;
500var
501 dayStr,timeStr: string;
502 dayList: TStringList;
503 i,Code,cnt : integer;
504 OrigSch: string;
505
506 procedure updateCheckbox(aDList: TStringList);
507 var
508 idx: integer;
509 x: string;
510 begin
511 for idx := aDList.Count - 1 downto 0 do
512 begin
513 // cq hds8326 PRN entered manually split PRN from DOW to retain last DOW
514 x := UpperCase(aDList.Strings[idx]); // added to properly process DOW when followed by a space "PRN".
515 if Piece(x,' ',2) = 'PRN' then
516 aDLIst.Strings[idx] := Piece(x,' ',1);
517 // cq hds8326
518 if ((CheckDay(aDList[idx]) = 'SUN') or (CheckDay(aDList[idx]) = 'SU')) then
519 begin
520 cbo7.Checked := true;
521 aDList[idx] := 'SU';
522 FDaySchedule[cbo7.tag] := 'SU';
523 end
524 else if ((CheckDay(aDList[idx]) = 'MON') or (CheckDay(aDList[idx]) = 'MO')) then
525 begin
526 cbo1.Checked := true;
527 aDList[idx] := 'MO';
528 FDaySchedule[cbo1.tag] := 'MO';
529 end
530 else if ((CheckDay(aDList[idx]) = 'TUE') or (CheckDay(aDList[idx]) = 'TU')) then
531 begin
532 cbo2.Checked := true;
533 aDList[idx] := 'TU';
534 FDaySchedule[cbo2.tag] := 'TU';
535 end
536 else if ((CheckDay(aDList[idx]) = 'WED') or (CheckDay(aDList[idx]) = 'WE')) then
537 begin
538 cbo3.Checked := true;
539 aDList[idx] := 'WE';
540 FDaySchedule[cbo3.tag] := 'WE';
541 end
542 else if ((CheckDay(aDList[idx]) = 'THU') or (CheckDay(aDList[idx]) = 'TH')) then
543 begin
544 cbo4.Checked := true;
545 aDList[idx] := 'TH';
546 FDaySchedule[cbo4.tag] := 'TH';
547 end
548 else if ((CheckDay(aDList[idx]) = 'FRI') or (CheckDay(aDList[idx]) = 'FR')) then
549 begin
550 cbo5.Checked := true;
551 aDList[idx] := 'FR';
552 FDaySchedule[cbo5.tag] := 'FR';
553 end
554 else if ((CheckDay(aDList[idx]) = 'SAT') or (CheckDay(aDList[idx]) = 'SA')) then
555 begin
556 cbo6.Checked := true;
557 aDList[idx] := 'SA';
558 FDaySchedule[cbo6.tag] := 'SA';
559 end
560 else aDList.Delete(idx);
561 end;
562 end;
563
564begin
565 inherited;
566 dayStr := '';
567 timeStr := '';
568 if Length (txtSchedule.Text) = 0 then
569 begin
570 FOtherSchedule := '';
571 btnReset.Click;
572 Exit;
573 end;
574 OrigSch := txtSchedule.Text;
575 dayList := TStringList.Create;
576 if Pos('@',txtSchedule.Text)>0 then
577 begin
578 dayStr := Trim(Piece(txtSchedule.Text,'@',1));
579 timeStr := Trim(Piece(txtSchedule.Text,'@',2));
580 end else
581 begin
582 Val(Piece(txtSchedule.Text,'-',1), i, Code);
583 if i = 0 then begin end; // just to make compiler not give hint
584 if Code <> 0 then dayStr := Trim(txtSchedule.Text)
585 else timeStr := Trim(txtSchedule.Text);
586 end;
587 FTimeSchedule.Clear;
588 for cnt := Low(FDaySchedule) to High(FDaySchedule) do
589 FDaySchedule[cnt] := '';
590 PiecesToList(timeStr, '-', FTimeSchedule);
591 if Length(dayStr)>0 then
592 begin
593 PiecesToList(dayStr, '-', dayList);
594 cbo7.Checked := False;
595 cbo1.Checked := False;
596 cbo2.Checked := False;
597 cbo3.Checked := False;
598 cbo4.Checked := False;
599 cbo5.Checked := False;
600 cbo6.Checked := False;
601 updateCheckbox(dayList);
602 end;
603
604 FOtherSchedule := txtSchedule.Text;
605end;
606
607procedure TfrmOtherSchedule.lstHourClick(Sender: TObject);
608begin
609 inherited;
610 if lstMinute.ItemIndex = -1 then lstMinute.ItemIndex :=0;
611end;
612
613procedure TfrmOtherSchedule.txtScheduleChange(Sender: TObject);
614begin
615 inherited;
616 FFromEditBox := True;
617 if not FFromCheckBox then
618 UpdateOnFreeTextInput;
619 FFromEditBox := False;
620end;
621
622function TfrmOtherSchedule.CheckDay(ADayStr: string): string;
623var
624 lng: integer;
625begin
626 lng := Length(ADayStr);
627 if lng <2 then
628 begin
629 result := '';
630 Exit;
631 end;
632 if (lng < 7) and ( UpperCase(aDayStr)= Copy('SUNDAY',1,lng)) then
633 result := 'SU'
634 else if (lng < 7) and (UpperCase(aDayStr)= Copy('MONDAY',1,lng)) then
635 result := 'MO'
636 else if (lng < 8) and (UpperCase(aDayStr)= Copy('TUESDAY',1,lng)) then
637 result := 'TU'
638 else if (lng < 10) and (UpperCase(aDayStr)= Copy('WEDNESDAY',1,lng)) then
639 result := 'WE'
640 else if (lng < 9) and (UpperCase(aDayStr)= Copy('THURSDAY',1,lng)) then
641 result := 'TH'
642 else if (lng < 7) and (UpperCase(aDayStr)= Copy('FRIDAY',1,lng)) then
643 result := 'FR'
644 else if (lng < 9) and (UpperCase(aDayStr)= Copy('SATURDAY',1,lng)) then
645 result := 'SA'
646 else
647 result := '';
648end;
649
650procedure TfrmOtherSchedule.EnabledSch(TF: boolean);
651begin
652 self.GroupBox3.Enabled := TF;
653 self.NSScboSchedule.Enabled := TF;
654 self.btnSchAdd.Enabled := TF;
655 self.btnSchRemove.Enabled := TF;
656// if TF = False then self.NSScboSchedule.Color := cl3DLight
657// else self.NSScboSchedule.Color := clWindow;
658 if TF = False then self.NSScboSchedule.ItemIndex := -1;
659end;
660
661procedure TfrmOtherSchedule.EnabledTime(TF: boolean);
662begin
663 self.GroupBox2.Enabled := TF;
664 self.lstHour.Enabled := TF;
665 self.lstMinute.Enabled := TF;
666 self.btnAdd.Enabled := TF;
667 self.btnRemove.Enabled := TF;
668 if TF = False then
669 begin
670 self.lstHour.ItemIndex := -1;
671 self.lstMinute.ItemIndex := -1;
672 end;
673end;
674
675procedure TfrmOtherSchedule.lstMinuteMouseUp(Sender: TObject;
676 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
677begin
678 inherited;
679 FFromCheckBox := True;
680 if lstHour.ItemIndex < 0 then Exit;
681 //btnAddClick(Self);
682 FFromCheckBox := False;
683end;
684
685procedure TfrmOtherSchedule.lstMinuteKeyDown(Sender: TObject;
686 var Key: Word; Shift: TShiftState);
687begin
688 inherited;
689 if (Key=VK_RETURN) then
690 begin
691 FFromCheckBox := True;
692 if lstHour.ItemIndex < 0 then Exit;
693 //btnAddClick(Self);
694 FFromCheckBox := False;
695 end;
696end;
697
698procedure TfrmOtherSchedule.Button1Click(Sender: TObject);
699begin
700 inherited;
701 cbo1.Checked := true;
702 cbo2.Checked := true;
703 cbo3.Checked := true;
704 cbo4.Checked := true;
705 cbo5.Checked := true;
706 cbo6.Checked := true;
707 cbo7.Checked := true;
708end;
709
710end.
711
Note: See TracBrowser for help on using the repository browser.