source: cprs/trunk/CPRS-Chart/fRemCoverSheet.pas@ 1751

Last change on this file since 1751 was 1679, checked in by healthsevak, 10 years ago

Updating the working copy to CPRS version 28

File size: 57.5 KB
RevLine 
[456]1unit fRemCoverSheet;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
[830]7 ORCtrls, StdCtrls, ExtCtrls, ComCtrls, ImgList, mImgText, Buttons, ORClasses, fBase508Form,
8 VA508AccessibilityManager, VA508ImageListLabeler;
[456]9
10type
11 TRemCoverDataLevel = (dlPackage, dlSystem, dlDivision, dlService, dlLocation, dlUserClass, dlUser);
12
[830]13 TfrmRemCoverSheet = class(TfrmBase508Form)
[456]14 pnlBottom: TORAutoPanel;
15 pnlUser: TPanel;
16 cbxUserLoc: TORComboBox;
17 lblRemLoc: TLabel;
18 pnlMiddle: TPanel;
19 pnlRight: TPanel;
20 mlgnCat: TfraImgText;
21 mlgnRem: TfraImgText;
22 mlgnAdd: TfraImgText;
23 pnlCAC: TORAutoPanel;
24 mlgnRemove: TfraImgText;
25 mlgnLock: TfraImgText;
26 imgMain: TImageList;
27 sbUp: TBitBtn;
28 sbDown: TBitBtn;
29 btnAdd: TBitBtn;
30 btnRemove: TBitBtn;
31 btnLock: TBitBtn;
32 pnlBtns: TPanel;
33 btnOK: TButton;
34 btnCancel: TButton;
35 edtSeq: TCaptionEdit;
36 udSeq: TUpDown;
37 lblSeq: TLabel;
38 btnApply: TButton;
39 cbSystem: TORCheckBox;
40 cbDivision: TORCheckBox;
41 cbService: TORCheckBox;
42 cbxService: TORComboBox;
43 cbxDivision: TORComboBox;
44 cbLocation: TORCheckBox;
45 cbUserClass: TORCheckBox;
46 cbUser: TORCheckBox;
47 cbxUser: TORComboBox;
48 cbxClass: TORComboBox;
49 cbxLocation: TORComboBox;
50 lblEdit: TLabel;
51 pnlInfo: TPanel;
52 pnlTree: TPanel;
53 tvAll: TORTreeView;
54 lblTree: TLabel;
55 pnlCover: TPanel;
56 lvCover: TCaptionListView;
57 pblMoveBtns: TPanel;
58 sbCopyRight: TBitBtn;
59 sbCopyLeft: TBitBtn;
60 splMain: TSplitter;
61 btnView: TButton;
62 lblLegend: TLabel;
[830]63 imgLblRemCoverSheet: TVA508ImageListLabeler;
64 compAccessCopyRight: TVA508ComponentAccessibility;
65 compAccessCopyLeft: TVA508ComponentAccessibility;
66 pnlTopLeft: TPanel;
67 lvView: TCaptionListView;
68 lblView: TLabel;
69 lblCAC: TVA508StaticText;
70 VA508ImageListLabeler1: TVA508ImageListLabeler;
[456]71 procedure cbxLocationNeedData(Sender: TObject; const StartFrom: String;
72 Direction, InsertAt: Integer);
73 procedure cbxServiceNeedData(Sender: TObject; const StartFrom: String;
74 Direction, InsertAt: Integer);
75 procedure cbxUserNeedData(Sender: TObject; const StartFrom: String;
76 Direction, InsertAt: Integer);
77 procedure cbxClassNeedData(Sender: TObject; const StartFrom: String;
78 Direction, InsertAt: Integer);
79 procedure FormDestroy(Sender: TObject);
80 procedure cbxDivisionChange(Sender: TObject);
81 procedure cbxServiceChange(Sender: TObject);
82 procedure cbxLocationChange(Sender: TObject);
83 procedure cbxClassChange(Sender: TObject);
84 procedure cbxUserChange(Sender: TObject);
85 procedure cbxDropDownClose(Sender: TObject);
86 procedure cbEditLevelClick(Sender: TObject);
87 procedure tvAllExpanding(Sender: TObject; Node: TTreeNode;
88 var AllowExpansion: Boolean);
89 procedure edtSeqChange(Sender: TObject);
90 procedure tvAllExpanded(Sender: TObject; Node: TTreeNode);
91 procedure tvAllChange(Sender: TObject; Node: TTreeNode);
92 procedure lvCoverChange(Sender: TObject; Item: TListItem;
93 Change: TItemChange);
94 procedure btnAddClick(Sender: TObject);
95 procedure btnRemoveClick(Sender: TObject);
96 procedure btnLockClick(Sender: TObject);
97 procedure lvViewColumnClick(Sender: TObject; Column: TListColumn);
98 procedure lvCoverColumnClick(Sender: TObject; Column: TListColumn);
99 procedure lvViewCompare(Sender: TObject; Item1, Item2: TListItem;
100 Data: Integer; var Compare: Integer);
101 procedure lvCoverCompare(Sender: TObject; Item1, Item2: TListItem;
102 Data: Integer; var Compare: Integer);
103 procedure sbUpClick(Sender: TObject);
104 procedure sbDownClick(Sender: TObject);
105 procedure sbCopyRightClick(Sender: TObject);
106 procedure udSeqChangingEx(Sender: TObject; var AllowChange: Boolean;
107 NewValue: Smallint; Direction: TUpDownDirection);
108 procedure sbCopyLeftClick(Sender: TObject);
109 procedure tvAllDblClick(Sender: TObject);
110 procedure btnApplyClick(Sender: TObject);
111 procedure btnOKClick(Sender: TObject);
112 procedure lvCoverDblClick(Sender: TObject);
113 procedure btnViewClick(Sender: TObject);
114 procedure lvCoverKeyDown(Sender: TObject; var Key: Word;
115 Shift: TShiftState);
116 procedure edtSeqKeyPress(Sender: TObject; var Key: Char);
117 procedure cbxDivisionKeyDown(Sender: TObject; var Key: Word;
118 Shift: TShiftState);
[830]119 procedure FormCreate(Sender: TObject);
120 procedure compAccessCopyRightCaptionQuery(Sender: TObject;
121 var Text: string);
122 procedure compAccessCopyLeftCaptionQuery(Sender: TObject; var Text: string);
123 procedure lvViewChange(Sender: TObject; Item: TListItem;
124 Change: TItemChange);
125 procedure lvViewSelectItem(Sender: TObject; Item: TListItem;
126 Selected: Boolean);
[1679]127 procedure lvViewExit(Sender: TObject);
128 procedure btnViewExit(Sender: TObject);
129 procedure lblCACExit(Sender: TObject);
130 procedure cbxUserLocExit(Sender: TObject);
131 procedure cbSystemExit(Sender: TObject);
132 procedure sbCopyRightExit(Sender: TObject);
133 procedure btnOKExit(Sender: TObject);
[456]134 private
135 FData: TORStringList; // DataCode IEN ^ Modified Flag Object=TStringList
136 FUserInfo: TORStringList; // C^User Class, D^Division
137 FUser: Int64;
138 FUserMode: boolean;
139 FInitialized: boolean;
140 FCurDiv: Integer;
141 FCurSer:Integer;
142 FCurLoc: Integer;
143 FCurClass: Integer;
144 FCurUser: Int64;
145 FDivisions: TORStringList;
146 FServices: TORStringList;
147 FLocations: TORStringList;
148 FClasses: TORStringList;
149 FUsers: TORStringList;
150 FMasterList: TORStringList;
151 FUpdatePending: TORCheckBox;
152 FCatInfo: TORStringList;
153 FEditingLevel: TRemCoverDataLevel;
154 FEditingIEN: Int64;
155 FUpdating: boolean;
156 FTopSortTag: integer;
157 FTopSortUp: boolean;
158 FBottomSortTag: integer;
159 FBottomSortUp: boolean;
160 FDataSaved: boolean;
161 FUpdatingView: boolean;
162 FInternalExpansion: boolean;
[830]163 FSavePause: integer;
164 FSelection: boolean;
165 fOldFocusChanged: TNotifyEvent;
166 procedure ActiveControlChanged(Sender: TObject);
167 procedure SetButtonHints;
[456]168 procedure GetUserInfo(AUser: Int64);
169 function GetCurrent(IEN: Int64; Level: TRemCoverDataLevel; Show: boolean;
170 Add: boolean = FALSE): TORStringList;
171 procedure UpdateView;
172 procedure SetupItem(Item: TListItem; const Data: string); overload;
173 procedure SetupItem(Item: TListItem; const Data: string;
174 Level: TRemCoverDataLevel; IEN: Int64); overload;
175 function GetExternalName(Level: TRemCoverDataLevel; IEN: Int64): string;
176 procedure UpdateMasterListView;
177 procedure UpdateButtons;
178 function GetCatInfo(CatIEN: string): TORStringList;
179 procedure MarkListAsChanged;
180 function GetIndex(List: TORStringList; Item: TListItem): integer;
181 procedure ChangeStatus(Code: string);
182 procedure SetSeq(Item: TListItem; const Value: string);
183 function ListHasData(Seq: string; SubIdx: integer): boolean;
184 procedure SaveData(FromApply: boolean);
185 function RPad(Str: String): String;
186 function GetCoverSheetLvlData(ALevel, AClass: string): TStrings;
[830]187 procedure LockButtonUpdate(data, FNAME, hint: string);
[456]188 public
[830]189 procedure Init(AsUser: boolean);
[456]190 end;
191
192procedure EditCoverSheetReminderList(AsUser: boolean);
193
194implementation
195
196uses rCore, uCore, uPCE, rProbs, rTIU, ORFn, rReminders, uReminders,
[830]197 fRemCoverPreview, VAUtils, VA508AccessibilityRouter;
[456]198
199{$R *.DFM}
[830]200{$R sremcvr}
[456]201
202const
203 DataCode: array[TRemCoverDataLevel] of string[1] =
204 { dlPackage } ('P',
205 { dlSystem } 'S',
206 { dlDivision } 'D',
207 { dlService } 'R',
208 { dlLocation } 'L',
209 { dlUserClass } 'C',
210 { dlUser } 'U');
211
212 DataName: array[TRemCoverDataLevel] of string =
213 { dlPackage } ('Package',
214 { dlSystem } 'System',
215 { dlDivision } 'Division',
216 { dlService } 'Service',
217 { dlLocation } 'Location',
218 { dlUserClass } 'User Class',
219 { dlUser } 'User');
220
221 InternalName: array[TRemCoverDataLevel] of string =
222 { dlPackage } ('PKG',
223 { dlSystem } 'SYS',
224 { dlDivision } 'DIV',
225 { dlService } 'SRV',
226 { dlLocation } 'LOC',
227 { dlUserClass } 'CLASS',
228 { dlUser } 'USR');
229
230
231 UserClassCode = 'C';
232 DivisionCode = 'D';
233 ServiceCode = 'S';
234
235 CVLockCode = 'L';
236 CVAddCode = 'N';
237 CVRemoveCode = 'R';
238 CVCatCode = 'C';
239 CVRemCode = 'R';
240
241 DummyNode = '^@Dummy Node@^';
242 IdxSeq = 0;
243 IdxLvl = 1;
244 IdxType = 2;
245 IdxTIEN = 3;
246 IdxLvl2 = 4;
247 IdxAdd = 5;
248 IdxIEN = 6;
249
[830]250 UnlockHint = 'Unlock a Reminder, reverting it''s status back to Added';
251 LockHint = 'Lock a Reminder to prevent it''s removal from a lower'
252 + CRLF + 'level Coversheet display. For example, if you lock'
253 + CRLF + 'a Reminder at the Service level, then that Reminder'
254 + CRLF + 'can not be removed from the coversheet display at'
255 + CRLF + 'the Location, User Class, or User levels.';
256 AddLockHint = 'Add and Lock a Reminder to prevent it''s removal from a lower'
257 + CRLF + 'level Coversheet display. For example, if you lock'
258 + CRLF + 'a Reminder at the Service level, then that Reminder'
259 + CRLF + 'can not be removed from the coversheet display at'
260 + CRLF + 'the Location, User Class, or User levels.';
261
[456]262procedure EditCoverSheetReminderList(AsUser: boolean);
263var
264 frmRemCoverSheet: TfrmRemCoverSheet;
265
266begin
267 frmRemCoverSheet := TfrmRemCoverSheet.Create(Application);
268 try
269 frmRemCoverSheet.Init(AsUser);
270 frmRemCoverSheet.ShowModal;
271 if frmRemCoverSheet.FDataSaved then
272 ResetReminderLoad;
273 finally
274 frmRemCoverSheet.Free;
275 end;
276end;
277
278{ TfrmRemCoverSheet }
279
280procedure TfrmRemCoverSheet.Init(AsUser: boolean);
281const
282 RemClsCode = ' NVL';
283 RemClsText:array[1..4] of string = ('','National','VISN','Local');
284
285var
286 LocCombo: TORComboBox;
287 i, idx: integer;
288 tmp, tmp2, tmp3: string;
289 Node: TORTreeNode;
290
291begin
292 FTopSortTag := 3;
293 FTopSortUp := TRUE;
294 FBottomSortTag := 2;
295 FBottomSortUp := TRUE;
296 FEditingLevel := dlPackage;
297
298 ResizeAnchoredFormToFont(self);
299 pnlBtns.Top := pnlBottom.Top + pnlBottom.Height;
300
301 FCatInfo := TORStringList.Create;
302 FData := TORStringList.Create;
303 FUserInfo := TORStringList.Create;
304 FDivisions := TORStringList.Create;
305 FServices := TORStringList.Create;
306 FLocations := TORStringList.Create;
307 FClasses := TORStringList.Create;
308 FUsers := TORStringList.Create;
309 FMasterList := TORStringList.Create;
[830]310 //FMasterList.Assign(GetAllRemindersAndCategories);
311 FastAssign(GetAllRemindersAndCategories, FMasterList);
[456]312 for i := 0 to FMasterList.Count-1 do
313 begin
314 tmp := FMasterList[i];
315 tmp2 := piece(tmp,U,4);
316 if tmp2 = piece(tmp,U,3) then
317 tmp2 := '';
318 tmp3 := piece(tmp,U,5);
319 if tmp3 = '' then tmp3 := ' ';
320 idx := pos(tmp3,RemClsCode);
321 if idx > 0 then
322 tmp3 := RemClsText[idx]
323 else
324 tmp3 := '';
325 if tmp3 <> '' then
326 begin
327 if tmp2 <> '' then
328 tmp2 := tmp2 + ' - ';
329 tmp2 := tmp2 + tmp3;
330 end;
331 if tmp2 <> '' then
332 tmp2 := ' (' + tmp2 + ')';
333 tmp := Piece(tmp,U,1) + Pieces(tmp,U,2,3) + tmp2 + U + tmp2;
334 FMasterList[i] := tmp;
335 end;
336
337 FUserMode := AsUser;
338 FCurUser := User.DUZ;
339 GetUserInfo(User.DUZ);
340 FCurLoc := Encounter.Location;
341 idx := FUserInfo.IndexOfPiece(DivisionCode);
342 if idx >= 0 then
343 FCurDiv := StrToIntDef(Piece(FUserInfo[idx],U,2),0)
344 else
345 FCurDiv := 0;
346 idx := FUserInfo.IndexOfPiece(ServiceCode);
347 if idx >= 0 then
348 FCurSer := StrToIntDef(Piece(FUserInfo[idx],U,2),0)
349 else
350 FCurSer := User.Service;
351 cbxUser.InitLongList(User.Name);
352 cbxUser.SelectByIEN(FCurUser);
353 GetPCECodes(FDivisions, TAG_HISTLOC);
354 FDivisions.Delete(0);
355 FCurClass := 0;
356 if AsUser then
357 begin
358 pnlCAC.Visible := FALSE;
359 LocCombo := cbxUserLoc;
360 btnLock.Visible := FALSE;
361 end
362 else
363 begin
364 pnlUser.Visible := FALSE;
365 LocCombo := cbxLocation;
[830]366 //cbxDivision.Items.Assign(FDivisions);
367 FastAssign(Fdivisions, cbxDivision.Items);
[456]368 cbxDivision.SelectByIEN(FCurDiv);
369 cbxService.InitLongList(GetExternalName(dlService, FCurSer));
370 cbxService.SelectByIEN(FCurSer);
371 cbxClass.InitLongList('');
372 if FCurClass <> 0 then
373 cbxClass.SelectByIEN(FCurClass);
374 end;
375 LocCombo.InitLongList(Encounter.LocationName);
376 LocCombo.SelectByIEN(FCurLoc);
377 if AsUser then
378 cbUser.Checked := TRUE;
379
380 tvAll.Items.BeginUpdate;
381 try
382 for i := 0 to FMasterList.Count-1 do
383 begin
384 Node := TORTreeNode(tvAll.Items.Add(nil,''));
385 Node.StringData := FMasterList[i];
386 if copy(FMasterList[i],1,1) = CVCatCode then
387 begin
388 idx := 1;
389 tvAll.Items.AddChild(Node, DummyNode);
390 end
391 else
392 idx := 0;
393 Node.ImageIndex := idx;
394 Node.SelectedIndex := idx;
395 end;
396 finally
397 tvAll.Items.EndUpdate;
398 end;
399
400 FInitialized := TRUE;
401 UpdateView;
402 UpdateButtons;
403end;
404
[1679]405procedure TfrmRemCoverSheet.lblCACExit(Sender: TObject);
406begin
407 inherited;
408 //TDP - CQ#19733 Corrected tabbing issues
409 if TabIsPressed() then
410 begin
411 if pnlUser.Visible then cbxUserLoc.SetFocus
412 else cbSystem.SetFocus;
413 end;
414 if ShiftTabIsPressed() then btnView.SetFocus;
415end;
416
[456]417procedure TfrmRemCoverSheet.cbxLocationNeedData(Sender: TObject;
418 const StartFrom: String; Direction, InsertAt: Integer);
419begin
420 TORComboBox(Sender).ForDataUse(SubSetOfLocations(StartFrom, Direction));
421end;
422
423procedure TfrmRemCoverSheet.cbxServiceNeedData(Sender: TObject;
424 const StartFrom: String; Direction, InsertAt: Integer);
425begin
426 cbxService.ForDataUse(ServiceSearch(StartFrom, Direction, TRUE));
427end;
428
429procedure TfrmRemCoverSheet.cbxUserNeedData(Sender: TObject;
430 const StartFrom: String; Direction, InsertAt: Integer);
431begin
432 cbxUser.ForDataUse(SubSetOfPersons(StartFrom, Direction));
433end;
434
435procedure TfrmRemCoverSheet.cbxClassNeedData(Sender: TObject;
436 const StartFrom: String; Direction, InsertAt: Integer);
437begin
438 cbxClass.ForDataUse(SubSetOfUserClasses(StartFrom, Direction));
439end;
440
441procedure TfrmRemCoverSheet.FormDestroy(Sender: TObject);
442begin
[830]443 Screen.OnActiveControlChange := fOldFocusChanged;
[456]444 FMasterList.Free;
445 FUsers.Free;
446 FClasses.Free;
447 FLocations.Free;
448 FServices.Free;
449 FDivisions.Free;
450 FUserInfo.Free;
451 FData.KillObjects;
452 FData.Free;
453 FCatInfo.KillObjects;
454 FCatInfo.Free;
[830]455 Application.HintHidePause := FSavePause //Reset Hint pause to original setting
[456]456end;
457
458procedure TfrmRemCoverSheet.GetUserInfo(AUser: Int64);
459begin
460 if FUser <> AUser then
461 begin
462 FUser := AUser;
[830]463 //FUserInfo.Assign(UserDivClassInfo(FUser));
464 FastAssign(UserDivClassInfo(FUser), FUserInfo);
[456]465 end;
466end;
467
468function TfrmRemCoverSheet.GetCurrent(IEN: Int64; Level: TRemCoverDataLevel;
469 Show: boolean; Add: boolean = FALSE): TORStringList;
470var
471 lvl, cls, sIEN: string;
472 tmpSL: TORStringList;
473 i, idx: integer;
474
475begin
476 idx := FData.IndexOfPiece(DataCode[Level] + IntToStr(IEN));
477 if idx < 0 then
478 begin
479 if (IEN = 0) and (not (Level in [dlPackage, dlSystem])) then
480 begin
481 Result := nil;
482 exit;
483 end;
484 cls := '';
485 sIEN := IntToStr(IEN);
486 lvl := InternalName[Level];
487 case Level of
488 dlDivision, dlService, dlLocation, dlUser:
489 lvl := lvl + '.`' + sIEN;
490 dlUserClass:
491 cls := sIEN;
492 end;
493 if (lvl <> '') then
494 begin
495 tmpSL := TORStringList.Create;
496 try
[830]497 //tmpSL.Assign(GetCoverSheetLvlData(lvl, cls));
498 FastAssign(GetCoverSheetLvlData(lvl, cls), tmpSL);
[456]499 if (not Add) and (tmpSL.Count = 0) then
500 FreeAndNil(tmpSL);
501 idx := FData.AddObject(DataCode[Level] + IntToStr(IEN), tmpSL);
502 except
503 tmpSL.Free;
504 raise;
505 end;
506 end;
507 end;
508 if idx >= 0 then
509 begin
510 tmpSL := TORStringList(FData.Objects[idx]);
511 if Add and (not assigned(tmpSL)) then
512 begin
513 tmpSL := TORStringList.Create;
514 FData.Objects[idx] := tmpSL;
515 end;
516 end
517 else
518 tmpSL := nil;
519 if Show and assigned(tmpSL) then
520 begin
521 for i := 0 to tmpSL.Count-1 do
522 SetupItem(lvView.Items.Add, tmpSL[i], Level, IEN);
523 end;
524 Result := tmpSL;
525end;
526
527procedure TfrmRemCoverSheet.UpdateView;
528var
529 idx: integer;
530
531begin
532 if FInitialized and (not FUpdatingView) then
533 begin
534 lvView.Items.BeginUpdate;
535 try
536 lvView.Items.Clear;
537 GetCurrent(0, dlPackage, TRUE);
538 GetCurrent(0, dlSystem, TRUE);
539 GetCurrent(FCurDiv, dlDivision, TRUE);
540 GetCurrent(FCurSer, dlService, TRUE);
541 GetCurrent(FCurLoc, dlLocation, TRUE);
542 if FCurClass > 0 then
543 GetCurrent(FCurClass, dlUserClass, TRUE)
544 else
545 begin
546 idx := -1;
547 repeat
548 idx := FUserInfo.IndexOfPiece(UserClassCode,U,1,idx);
549 if idx >= 0 then
550 GetCurrent(StrToIntDef(Piece(FUserInfo[idx],U,2),0), dlUserClass, TRUE)
551 until(idx < 0);
552 end;
553 GetCurrent(FCurUser, dlUser, TRUE);
554 finally
555 lvView.Items.EndUpdate;
556 end;
557 end;
558end;
559
[830]560procedure TfrmRemCoverSheet.compAccessCopyLeftCaptionQuery(Sender: TObject;
561 var Text: string);
562begin
563 Text := 'Remove Reminder from ' + DataName[FEditingLevel] + ' Level Reminders List';
564end;
565
566procedure TfrmRemCoverSheet.compAccessCopyRightCaptionQuery(
567 Sender: TObject; var Text: string);
568begin
569 Text := 'Copy Reminder into ' + DataName[FEditingLevel] + ' Level Reminders List';
570end;
571
[456]572procedure TfrmRemCoverSheet.SetupItem(Item: TListItem; const Data: string);
573var
574 AddCode, RemCode, rIEN, Seq: string;
575
576begin
577 Seq := Piece(Data,U,1);
578 rIEN := Piece(Data,U,2);
579 Item.Caption := Piece(Data,U,3);
580 AddCode := copy(rIEN,1,1);
581 RemCode := copy(rIEN,2,1);
582 delete(rIEN,1,1);
583 if AddCode = CVLockCode then
584 Item.StateIndex := 5
585 else
586 if AddCode = CVRemoveCode then
587 Item.StateIndex := 4
588 else
589 if AddCode = CVAddCode then
590 Item.StateIndex := 3;
591 if RemCode = CVCatCode then
592 Item.ImageIndex := 1
593 else
594 if RemCode = CVRemCode then
595 Item.ImageIndex := 0
596 else
597 Item.ImageIndex := -1;
598 Item.SubItems.Clear;
599 Item.SubItems.Add(Seq); // IdxSeq = 0
600 Item.SubItems.Add(''); // IdxLvl = 1
601 Item.SubItems.Add(''); // IdxType = 2
602 Item.SubItems.Add(''); // IdxTIEN = 3
603 Item.SubItems.Add(''); // IdxLvl2 = 4
604 Item.SubItems.Add(AddCode); // IdxAdd = 5
605 Item.SubItems.Add(rIEN); // IdxIEN = 6
606end;
607
608procedure TfrmRemCoverSheet.SetupItem(Item: TListItem; const Data: string;
609 Level: TRemCoverDataLevel; IEN: Int64);
610begin
611 SetupItem(Item, Data);
612 Item.SubItems[IdxLvl] := DataName[Level];
613 Item.SubItems[IdxType] := GetExternalName(Level, IEN);
614 Item.SubItems[IdxTIEN] := IntToStr(IEN);
615 Item.SubItems[IdxLvl2] := IntToStr(ord(Level));
616end;
617
618function TfrmRemCoverSheet.GetExternalName(Level: TRemCoverDataLevel; IEN: Int64): string;
619
620 function GetNameFromList(List: TORStringList; IEN: Int64; FileNum: Double): string;
621 var
622 idx: integer;
623
624 begin
625 idx := List.IndexOfPiece(IntToStr(IEN));
626 if idx < 0 then
627 idx := List.Add(IntToStr(IEN) + U + ExternalName(IEN, FileNum));
[830]628 Result := piece(List[idx],U,2);
[456]629 end;
630
631begin
632 case Level of
633 dlDivision: Result := GetNameFromList(FDivisions, IEN, 4);
634 dlService: Result := GetNameFromList(FServices, IEN, 49);
635 dlLocation: Result := GetNameFromList(FLocations, IEN, 44);
636 dlUserClass: Result := GetNameFromList(FClasses, IEN, 8930);
637 dlUser: Result := GetNameFromList(FUsers, IEN, 200);
638 else Result := '';
639 end;
640end;
641
642procedure TfrmRemCoverSheet.cbxDivisionChange(Sender: TObject);
643begin
644 FCurDiv := cbxDivision.ItemIEN;
[830]645 If FCurDiv < 1 then //No value in Division combobox
646 begin
647 sbCopyLeft.Enabled := false;
648 sbCopyRight.Enabled := false;
649 FSelection := false;
650 end
651 else
652 FSelection := true;
[456]653 FUpdatePending := cbDivision;
654 if not cbxDivision.DroppedDown then
655 cbxDropDownClose(nil);
656end;
657
658procedure TfrmRemCoverSheet.cbxServiceChange(Sender: TObject);
659begin
660 FCurSer := cbxService.ItemIEN;
[830]661 If FCurSer < 1 then //No value in Service combobox
662 begin
663 sbCopyLeft.Enabled := false;
664 sbCopyRight.Enabled := false;
665 FSelection := false;
666 end
667 else
668 FSelection := true;
[456]669 FUpdatePending := cbService;
670 if not cbxService.DroppedDown then
671 cbxDropDownClose(nil);
672end;
673
674procedure TfrmRemCoverSheet.cbxLocationChange(Sender: TObject);
675begin
676 FCurLoc := TORComboBox(Sender).ItemIEN;
[830]677 If FCurLoc < 1 then //No value in Location combobox
678 begin
679 sbCopyLeft.Enabled := false;
680 sbCopyRight.Enabled := false;
681 FSelection := false;
682 end
683 else
684 FSelection := true;
[456]685 FUpdatePending := cbLocation;
686 if not TORComboBox(Sender).DroppedDown then
687 cbxDropDownClose(nil);
688end;
689
690procedure TfrmRemCoverSheet.cbxClassChange(Sender: TObject);
691begin
692 FCurClass := cbxClass.ItemIEN;
[830]693 If FCurClass < 1 then //No value in User Class combobox
694 begin
695 sbCopyLeft.Enabled := false;
696 sbCopyRight.Enabled := false;
697 FSelection := false;
698 end
699 else
700 FSelection := true;
[456]701 FUpdatePending := cbUserClass;
702 if not cbxClass.DroppedDown then
703 cbxDropDownClose(nil);
704end;
705
706procedure TfrmRemCoverSheet.cbxUserChange(Sender: TObject);
707var
708 NewVal, idx: integer;
709
710begin
711 FCurUser := cbxUser.ItemIEN;
[830]712 If FCurUser < 1 then //No value in User combobox
713 begin
714 sbCopyLeft.Enabled := false;
715 sbCopyRight.Enabled := false;
716 FSelection := false;
717 end
718 else
719 FSelection := true;
[456]720 GetUserInfo(FCurUser);
721 idx := FUserInfo.IndexOfPiece(DivisionCode);
722 if idx >= 0 then
723 begin
724 NewVal := StrToIntDef(Piece(FUserInfo[idx],U,2),0);
725 if NewVal <> FCurDiv then
726 begin
727 FCurDiv := NewVal;
728 cbxDivision.InitLongList(GetExternalName(dlDivision, NewVal));
729 cbxDivision.SelectByIEN(NewVal);
730 end;
731 end;
732 idx := FUserInfo.IndexOfPiece(ServiceCode);
733 if idx >= 0 then
734 begin
735 NewVal := StrToIntDef(Piece(FUserInfo[idx],U,2),0);
736 if NewVal <> FCurSer then
737 begin
738 FCurSer := NewVal;
739 cbxService.InitLongList(GetExternalName(dlService, NewVal));
740 cbxService.SelectByIEN(NewVal);
741 end;
742 end;
743 FCurClass := 0;
744 cbxClass.ItemIndex := -1;
745 FUpdatePending := cbUser;
746 if not cbxUser.DroppedDown then
747 cbxDropDownClose(nil);
748end;
749
[1679]750procedure TfrmRemCoverSheet.cbxUserLocExit(Sender: TObject);
751begin
752 inherited;
753 //TDP - CQ#19733 Corrected tabbing issues
754 if ShiftTabIsPressed() then
755 begin
756 if ScreenReaderSystemActive then lblCAC.SetFocus
757 else btnView.SetFocus;
758 end;
759end;
760
[456]761procedure TfrmRemCoverSheet.cbxDropDownClose(Sender: TObject);
762begin
763 if assigned(FUpdatePending) then
764 begin
765 UpdateView;
766 if FInitialized and (not FUserMode) then
767 begin
768 if FUpdatePending.Checked then
769 cbEditLevelClick(FUpdatePending)
770 else
771 FUpdatePending.Checked := TRUE;
772 end;
773 FUpdatePending := nil;
774 end;
775end;
776
777procedure TfrmRemCoverSheet.cbEditLevelClick(Sender: TObject);
778var
779 cb: TORCheckBox;
780 tmp: string;
781
782begin
783 cb := TORCheckBox(Sender);
784 if cb.Checked then
785 begin
786 FEditingLevel := TRemCoverDataLevel(cb.Tag);
787 if FEditingLevel <> dlUserClass then
788 begin
789 FCurClass := 0;
790 cbxClass.ItemIndex := -1;
791 end;
792 case FEditingLevel of
793 dlDivision: FEditingIEN := FCurDiv;
794 dlService: FEditingIEN := FCurSer;
795 dlLocation: FEditingIEN := FCurLoc;
796 dlUserClass: FEditingIEN := FCurClass;
797 dlUser: FEditingIEN := FCurUser;
798 else FEditingIEN := 0;
799 end;
800 if FEditingIEN = 0 then
[830]801 begin
802 tmp := ' ';
803 IF FEditingLevel = dlSystem then
804 FSelection := true
805 else
806 begin
807 sbCopyLeft.Enabled := false;
808 sbCopyRight.Enabled := false;
809 FSelection := false;
810 end;
811 end
[456]812 else
[830]813 begin
[456]814 tmp := ': ';
[830]815 FSelection := true;
816 end;
[456]817 lblEdit.Caption := ' Editing Cover Sheet Reminders for ' + DataName[FEditingLevel] +
818 tmp + GetExternalName(FEditingLevel, FEditingIEN);
819 lvCover.Columns[0].Caption := DataName[FEditingLevel] + ' Level Reminders';
[830]820
821 SetButtonHints; {Setup hints for Lock, Add, Remove buttons based on
822 Parameter Level}
[456]823 UpdateView;
824 UpdateMasterListView;
825 end
826 else
827 begin
[830]828 FSelection := false;
829 sbCopyLeft.Enabled := false;
830 sbCopyRight.Enabled := false;
[456]831 FEditingLevel := dlPackage;
832 FEditingIEN := 0;
833 lblEdit.Caption := '';
834 lvCover.Items.BeginUpdate;
835 try
836 lvCover.Items.Clear;
837 finally
838 lvCover.Items.EndUpdate;
839 end;
840 end;
841
842end;
843
[1679]844procedure TfrmRemCoverSheet.cbSystemExit(Sender: TObject);
845begin
846 inherited;
847 //TDP - CQ#19733 Corrected tabbing issues
848 if ShiftTabIsPressed() then
849 begin
850 if ScreenReaderSystemActive then lblCAC.SetFocus
851 else btnView.SetFocus;
852 end;
853end;
854
[456]855procedure TfrmRemCoverSheet.UpdateMasterListView;
856var
857 i: integer;
858 tmpSL: TStringList;
859 itm: TListItem;
860
861begin
862 lvCover.Items.BeginUpdate;
863 try
864 lvCover.Items.Clear;
865 if FEditingLevel <> dlPackage then
866 begin
867 tmpSL := GetCurrent(FEditingIEN, FEditingLevel, FALSE);
868 if assigned(tmpSL) then
869 begin
870 for i := 0 to tmpSL.Count-1 do
871 begin
872 itm := lvCover.Items.Add;
873 SetupItem(itm, tmpSL[i]);
874 end;
875 end;
876 end;
877 finally
878 lvCover.Items.EndUpdate;
879 end;
880 UpdateButtons;
881end;
882
883procedure TfrmRemCoverSheet.UpdateButtons;
884var
[830]885 FocusOK, ok: boolean;
886 i, idx: integer;
[456]887 Current, Lowest, Highest: integer;
[830]888 tmp: string;
889 tmpSL: TORstringlist;
890 doDownButton, doUpButton: boolean;
[456]891
892begin
893 lvCover.Enabled := (FEditingLevel <> dlPackage);
[830]894 ok := assigned(tvAll.Selected) and (FEditingLevel <> dlPackage) and (FSelection);
[456]895 sbCopyRight.Enabled := ok;
896
[830]897 ok := assigned(lvCover.Selected) and (FEditingLevel <> dlPackage) and (FSelection);
[456]898 sbCopyLeft.Enabled := ok;
899
900 ok := assigned(lvCover.Selected);
901 lblSeq.Enabled := ok;
902 edtSeq.Enabled := ok;
903
904 FUpdating := TRUE;
905 try
906 udSeq.Enabled := ok;
907 if ok then
908 udSeq.Position := StrToIntDef(lvCover.Selected.SubItems[IdxSeq],1)
909 else
910 udSeq.Position := 1;
911 finally
912 FUpdating := FALSE;
913 end;
914
[830]915 FocusOK := lvCover.Focused or sbUp.Focused or sbDown.Focused or edtSeq.Focused or
916 udSeq.Focused or btnAdd.Focused or btnRemove.Focused or btnLock.Focused or
917 btnOK.Focused; // add btnOK so you can shift-tab backwards into list
918 btnAdd.Enabled := ok and FocusOK;
919 btnRemove.Enabled := ok and (FEditingLevel <> dlSystem) and FocusOK;
920 btnLock.Enabled := ok and (FEditingLevel <> dlUser) and FocusOK;
[456]921 if ok then
[830]922 begin
923 tmpSL := GetCurrent(FEditingIEN, FEditingLevel, FALSE);
924 if assigned(tmpSL) then
925 begin
926 Idx := GetIndex(tmpSL, lvCover.Selected);
927 if Idx >= 0 then
928 begin
929 tmp := tmpSL[idx];
930 tmp := piece(tmp,u,2);
931 tmp := copy(tmp,1,1);
932 if tmp = 'L' then
933 begin
934 LockButtonUpdate('Unlock', 'BMP_UNLOCK', UnlockHint);
935 end;
936 if tmp = 'N' then
937 begin
938 LockButtonUpdate('Lock', 'BMP_LOCK', LockHint);
939 end;
940 if tmp = 'R' then
941 begin
942 LockButtonUpdate('Add && Lock', 'BMP_LOCK', AddLockHint);
943 end;
944 end;
945 end;
[456]946 ok :=(lvCover.Items.Count > 1);
[830]947 end;
[456]948 Lowest := 99999;
949 Highest := -1;
950 if ok then
951 begin
952 for i := 0 to lvCover.Items.Count-1 do
953 begin
954 Current := StrToIntDef(lvCover.Items[i].SubItems[IdxSeq], 0);
955 if Lowest > Current then
956 Lowest := Current;
957 if Highest < Current then
958 Highest := Current;
959 end;
[830]960 Current := StrToIntDef(lvCover.Selected.SubItems[IdxSeq], 0);
[456]961 end
962 else
963 Current := 0;
[830]964 doDownButton := (sbUp.Focused and (Current = Lowest));
965 doUpButton := (sbDown.Focused and (Current = Highest));
[456]966 sbUp.Enabled := ok and (Current > Lowest);
967 sbDown.Enabled := ok and (Current < Highest);
[830]968 if doDownButton and sbDown.enabled then sbDown.SetFocus;
969 if doUpButton and sbUp.enabled then sbUp.SetFocus;
[456]970end;
971
972procedure TfrmRemCoverSheet.tvAllExpanding(Sender: TObject;
973 Node: TTreeNode; var AllowExpansion: Boolean);
974var
975 List: TORStringList;
976 i, idx: integer;
977 CNode: TORTreeNode;
978
979begin
980 if Node.GetFirstChild.Text = DummyNode then
981 begin
982 Node.DeleteChildren;
983 List := GetCatInfo(copy(piece(TORTreeNode(Node).StringData,U,1),2,99));
984 if assigned(List) then
985 begin
986 for i := 0 to List.Count-1 do
987 begin
988 CNode := TORTreeNode(tvAll.Items.AddChild(Node,''));
989 CNode.StringData := List[i];
990 if copy(List[i],1,1) = CVCatCode then
991 begin
992 idx := 1;
993 tvAll.Items.AddChild(CNode, DummyNode);
994 end
995 else
996 idx := 0;
997 CNode.ImageIndex := idx;
998 CNode.SelectedIndex := idx;
999 end;
1000 end;
1001 end;
1002 if FInternalExpansion then
1003 AllowExpansion := FALSE
1004 else
1005 AllowExpansion := Node.HasChildren;
1006end;
1007
1008function TfrmRemCoverSheet.GetCatInfo(CatIEN: string): TORStringList;
1009var
1010 i, j, idx: integer;
1011 tmp: string;
1012 tmpSL: TStrings;
1013
1014begin
1015 idx := FCatInfo.IndexOf(CatIEN);
1016 if idx < 0 then
1017 begin
1018 Result := TORStringList.Create;
1019 try
1020 tmpSL := GetCategoryItems(StrToIntDef(CatIEN,0));
1021 for i := 0 to tmpSL.Count-1 do
1022 begin
1023 tmp := copy(tmpSL[i],1,1);
1024 if tmp = CVCatCode then
1025 idx := 3
1026 else
1027 idx := 4;
1028 tmp := tmp + Piece(tmpSL[i],U,2) + U + Piece(tmpSL[i],U,idx);
1029 j := FMasterList.IndexOfPiece(piece(tmp,U,1));
1030 if j >= 0 then
1031 tmp := tmp + piece(FMasterList[j],U,3);
1032 Result.Add(tmp);
1033 end;
1034 FCatInfo.AddObject(CatIEN, Result);
1035 except
1036 Result.Free;
1037 raise;
1038 end;
1039 end
1040 else
1041 Result := TORStringList(FCatInfo.Objects[idx]);
1042end;
1043
1044procedure TfrmRemCoverSheet.MarkListAsChanged;
1045var
1046 tmp: string;
1047 idx: integer;
1048
1049begin
1050 idx := FData.IndexOfPiece(DataCode[FEditingLevel] + IntToStr(FEditingIEN));
1051 if idx >= 0 then
1052 begin
1053 tmp := FData[idx];
1054 SetPiece(Tmp,U,2,BoolChar[TRUE]);
1055 FData[idx] := tmp;
1056 btnApply.Enabled := TRUE;
1057 UpdateView;
1058 end;
1059end;
1060
1061procedure TfrmRemCoverSheet.edtSeqChange(Sender: TObject);
1062begin
1063 if FUpdating or (not FInitialized) then exit;
1064 if FBottomSortTag <> 2 then
1065 begin
1066 FBottomSortTag := 2;
1067 lvCover.CustomSort(nil, 0);
1068 end;
1069 SetSeq(lvCover.Selected, IntToStr(udSeq.Position));
1070 lvCover.CustomSort(nil, 0);
1071 UpdateButtons;
1072end;
1073
1074procedure TfrmRemCoverSheet.tvAllExpanded(Sender: TObject;
1075 Node: TTreeNode);
1076var
1077 idx: integer;
1078
1079begin
1080 if Node.Expanded then
1081 idx := 2
1082 else
1083 idx := 1;
1084 Node.ImageIndex := idx;
1085 Node.SelectedIndex := idx;
1086end;
1087
1088procedure TfrmRemCoverSheet.tvAllChange(Sender: TObject; Node: TTreeNode);
1089begin
1090 UpdateButtons;
1091end;
1092
1093procedure TfrmRemCoverSheet.lvCoverChange(Sender: TObject; Item: TListItem;
1094 Change: TItemChange);
1095begin
1096 UpdateButtons;
1097end;
1098
1099function TfrmRemCoverSheet.GetIndex(List: TORStringList;
1100 Item: TListItem): integer;
1101var
1102 IEN: string;
1103
1104begin
1105 if assigned(Item) and assigned(List) then
1106 begin
1107 IEN := Item.SubItems[IdxAdd] + Item.SubItems[IdxIEN];
1108 Result := List.IndexOfPiece(IEN,U,2);
1109 end
1110 else
1111 Result := -1;
1112end;
1113
1114procedure TfrmRemCoverSheet.ChangeStatus(Code: string);
1115var
1116 tmpSL: TORStringList;
1117 Idx: integer;
1118 tmp,p: string;
1119
1120begin
1121 tmpSL := GetCurrent(FEditingIEN, FEditingLevel, FALSE);
1122 if assigned(tmpSL) then
1123 begin
1124 Idx := GetIndex(tmpSL, lvCover.Selected);
1125 if Idx >= 0 then
1126 begin
1127 tmp := tmpSL[idx];
1128 p := Piece(tmp,U,2);
1129 SetPiece(tmp,U,2,Code + copy(p,2,MaxInt));
1130 tmpSL[idx] := tmp;
1131 MarkListAsChanged;
1132 SetupItem(lvCover.Selected, tmp);
[830]1133 tmp := piece(tmp,u,2);
1134 tmp := copy(tmp,1,1);
1135 if tmp = 'L' then
1136 begin
1137 LockButtonUpdate('Unlock', 'BMP_UNLOCK', UnlockHint);
1138 end;
1139 if tmp = 'N' then
1140 begin
1141 LockButtonUpdate('Lock', 'BMP_LOCK', LockHint);
1142 end;
1143 if tmp = 'R' then
1144 begin
1145 LockButtonUpdate('Add && Lock', 'BMP_LOCK', AddLockHint);
1146 end;
[456]1147 end;
1148 end;
1149end;
1150
1151procedure TfrmRemCoverSheet.btnAddClick(Sender: TObject);
1152begin
1153 ChangeStatus(CVAddCode);
1154end;
1155
1156procedure TfrmRemCoverSheet.btnRemoveClick(Sender: TObject);
1157begin
1158 ChangeStatus(CVRemoveCode);
1159end;
1160
1161procedure TfrmRemCoverSheet.btnLockClick(Sender: TObject);
1162begin
1163 ChangeStatus(CVLockCode);
1164end;
1165
1166procedure TfrmRemCoverSheet.lvViewColumnClick(Sender: TObject;
1167 Column: TListColumn);
1168begin
1169 if FTopSortTag = Column.Tag then
1170 FTopSortUp := not FTopSortUp
1171 else
1172 FTopSortTag := Column.Tag;
1173 lvView.CustomSort(nil, 0);
1174end;
1175
1176type
1177 TSortData = (sdRem, sdSeq, sdLvl, sdOther);
1178
1179procedure TfrmRemCoverSheet.lvCoverColumnClick(Sender: TObject;
1180 Column: TListColumn);
1181begin
1182 if FBottomSortTag = Column.Tag then
1183 FBottomSortUp := not FBottomSortUp
1184 else
1185 FBottomSortTag := Column.Tag;
1186 lvCover.CustomSort(nil, 0);
1187end;
1188
1189procedure TfrmRemCoverSheet.lvViewCompare(Sender: TObject; Item1,
1190 Item2: TListItem; Data: Integer; var Compare: Integer);
1191var
1192 i: integer;
1193 odr: array[1..4] of TSortData;
1194 s1, s2: string;
1195
1196begin
1197 odr[1] := TSortData(FTopSortTag-1);
1198 case FTopSortTag of
1199 1: begin
1200 odr[2] := sdSeq;
1201 odr[3] := sdLvl;
1202 odr[4] := sdOther;
1203 end;
1204
1205 2: begin
1206 odr[2] := sdLvl;
1207 odr[3] := sdOther;
1208 odr[4] := sdRem;
1209 end;
1210
1211 3: begin
1212 odr[2] := sdOther;
1213 odr[3] := sdSeq;
1214 odr[4] := sdRem;
1215 end;
1216
1217 4: begin
1218 odr[2] := sdLvl;
1219 odr[3] := sdSeq;
1220 odr[4] := sdRem;
1221 end;
1222 end;
1223 Compare := 0;
1224 for i := 1 to 4 do
1225 begin
1226 case odr[i] of
1227 sdRem: begin
1228 s1 := Item1.Caption;
1229 s2 := Item2.Caption;
1230 end;
1231
1232 sdSeq: begin
1233 s1 := RPad(Item1.SubItems[IdxSeq]);
1234 s2 := RPad(Item2.SubItems[IdxSeq]);
1235 end;
1236
1237 sdLvl: begin
1238 s1 := Item1.SubItems[IdxLvl2];
1239 s2 := Item2.SubItems[IdxLvl2];
1240 end;
1241
1242 sdOther: begin
1243 s1 := Item1.SubItems[IdxType];
1244 s2 := Item2.SubItems[IdxType];
1245 end;
1246
1247 end;
1248 Compare := CompareText(s1, s2);
1249 if Compare <> 0 then break;
1250 end;
1251 if not FTopSortUp then
1252 Compare := -Compare;
1253end;
1254
[1679]1255procedure TfrmRemCoverSheet.lvViewExit(Sender: TObject);
1256begin
1257 inherited;
1258 //TDP - CQ#19733 Corrected tabbing issues
1259 if TabIsPressed() then btnView.SetFocus;
1260end;
1261
[456]1262procedure TfrmRemCoverSheet.lvCoverCompare(Sender: TObject; Item1,
1263 Item2: TListItem; Data: Integer; var Compare: Integer);
1264var
1265 i: integer;
1266 odr: array[1..2] of TSortData;
1267 s1, s2: string;
1268
1269begin
1270 case FBottomSortTag of
1271 1: begin
1272 odr[1] := sdRem;
1273 odr[2] := sdSeq;
1274 end;
1275
1276 2: begin
1277 odr[1] := sdSeq;
1278 odr[2] := sdRem;
1279 end;
1280 end;
1281 Compare := 0;
1282 for i := 1 to 2 do
1283 begin
1284 case odr[i] of
1285 sdRem: begin
1286 s1 := Item1.Caption;
1287 s2 := Item2.Caption;
1288 end;
1289
1290 sdSeq: begin
1291 s1 := RPad(Item1.SubItems[IdxSeq]);
1292 s2 := RPad(Item2.SubItems[IdxSeq]);
1293 end;
1294 end;
1295 Compare := CompareText(s1, s2);
1296 if Compare <> 0 then break;
1297 end;
1298 if not FBottomSortUp then
1299 Compare := -Compare;
1300end;
1301
1302procedure TfrmRemCoverSheet.sbUpClick(Sender: TObject);
1303var
1304 NextItem: TListItem;
1305 Seq1, Seq2: string;
1306
1307begin
1308 if assigned(lvCover.Selected) then
1309 begin
1310 if FBottomSortTag <> 2 then
1311 begin
1312 FBottomSortTag := 2;
1313 lvCover.CustomSort(nil, 0);
1314 end;
1315 if lvCover.Selected.Index > 0 then
1316 begin
1317 NextItem := lvCover.Items[lvCover.Selected.Index - 1];
1318 Seq1 := NextItem.SubItems[IdxSeq];
1319 Seq2 := lvCover.Selected.SubItems[IdxSeq];
1320 SetSeq(NextItem, Seq2);
1321 SetSeq(lvCover.Selected, Seq1);
1322 lvCover.CustomSort(nil, 0);
[830]1323 If ScreenReaderSystemActive then
1324 GetScreenReader.Speak('Reminder Moved up in Sequence');
[456]1325 UpdateButtons;
1326 end;
1327 end;
1328end;
1329
1330procedure TfrmRemCoverSheet.sbDownClick(Sender: TObject);
1331var
1332 NextItem: TListItem;
1333 Seq1, Seq2: string;
1334
1335begin
1336 if assigned(lvCover.Selected) then
1337 begin
1338 if FBottomSortTag <> 2 then
1339 begin
1340 FBottomSortTag := 2;
1341 lvCover.CustomSort(nil, 0);
1342 end;
1343 if lvCover.Selected.Index < (lvCover.Items.Count-1) then
1344 begin
1345 NextItem := lvCover.Items[lvCover.Selected.Index + 1];
1346 Seq1 := NextItem.SubItems[IdxSeq];
1347 Seq2 := lvCover.Selected.SubItems[IdxSeq];
1348 SetSeq(NextItem, Seq2);
1349 SetSeq(lvCover.Selected, Seq1);
1350 lvCover.CustomSort(nil, 0);
[830]1351 If ScreenReaderSystemActive then
1352 GetScreenReader.Speak('Reminder Moved down in Sequence');
[456]1353 UpdateButtons;
1354 end;
1355 end;
1356end;
1357
1358procedure TfrmRemCoverSheet.SetSeq(Item: TListItem; const Value: string);
1359var
1360 tmpSL: TORStringList;
1361 Idx: integer;
1362 tmp: string;
1363
1364begin
1365 tmpSL := GetCurrent(FEditingIEN, FEditingLevel, FALSE);
1366 if assigned(tmpSL) then
1367 begin
1368 Idx := GetIndex(tmpSL, Item);
1369 if Idx >= 0 then
1370 begin
1371 tmp := tmpSL[idx];
1372 if(Piece(Tmp,U,1) <> Value) then
1373 begin
1374 SetPiece(tmp,U,1,Value);
1375 tmpSL[idx] := tmp;
1376 MarkListAsChanged;
1377 SetupItem(Item, tmp);
1378 end;
1379 end;
1380 end;
1381end;
1382
1383procedure TfrmRemCoverSheet.sbCopyRightClick(Sender: TObject);
1384var
1385 i: integer;
1386 Seq, Cur, Idx: integer;
1387 tmpSL: TORStringList;
1388 IEN: string;
1389
1390begin
1391 if assigned(tvAll.Selected) then
1392 begin
1393 IEN := Piece(TORTreeNode(tvAll.Selected).StringData, U, 1);
1394 if ListHasData(IEN, IdxIEN) then
1395 begin
[830]1396 ShowMsg('List already contains this Reminder');
[456]1397 exit;
1398 end;
1399 if lvCover.Items.Count = 0 then
1400 Seq := 10
1401 else
1402 begin
1403 Seq := 0;
1404 for i := 0 to lvCover.Items.Count-1 do
1405 begin
1406 Cur := StrToIntDef(lvCover.Items[i].SubItems[IdxSeq], 0);
1407 if Seq < Cur then
1408 Seq := Cur;
1409 end;
1410 inc(Seq,10);
1411 if Seq > 999 then
1412 begin
1413 Seq := 999;
1414 while (Seq > 0) and ListHasData(IntToStr(Seq), IdxSeq) do dec(Seq);
1415 end;
1416 end;
1417 if Seq > 0 then
1418 begin
1419 tmpSL := GetCurrent(FEditingIEN, FEditingLevel, FALSE, TRUE);
1420 Idx := tmpSL.IndexOfPiece(IEN,U,2);
1421 if Idx < 0 then
1422 begin
1423 tmpSL.Add(IntToStr(Seq) + U + CVAddCode + TORTreeNode(tvAll.Selected).StringData);
1424 MarkListAsChanged;
1425 UpdateMasterListView;
1426 for i := 0 to lvCover.Items.Count-1 do
1427 if IEN = lvCover.Items[i].SubItems[IdxIEN] then
1428 begin
1429 lvCover.Selected := lvCover.Items[i];
1430 break;
1431 end;
1432 end;
[830]1433 if ScreenReaderSystemActive then
1434 GetScreenReader.Speak('Reminder Added to ' + DataName[FEditingLevel] + ' Level Reminders List');
[456]1435 end;
1436 end;
1437end;
1438
[1679]1439procedure TfrmRemCoverSheet.sbCopyRightExit(Sender: TObject);
1440begin
1441 inherited;
1442 //TDP - CQ#19733 On Tab from sbCopyRight, go to btnOK if no data in lvCover
1443 if TabIsPressed() then
1444 begin
1445 if not ScreenReaderSystemActive then
1446 begin
1447 if lvCover.Items.Count = 0 then btnOK.SetFocus;
1448 end;
1449 end;
1450end;
1451
[456]1452function TfrmRemCoverSheet.ListHasData(Seq: string; SubIdx: integer): boolean;
1453var
1454 i: integer;
1455
1456begin
1457 Result := FALSE;
1458 for i := 0 to lvCover.Items.Count-1 do
1459 if Seq = lvCover.Items[i].SubItems[SubIdx] then
1460 begin
1461 Result := TRUE;
1462 break;
1463 end;
1464end;
1465
1466procedure TfrmRemCoverSheet.udSeqChangingEx(Sender: TObject;
1467 var AllowChange: Boolean; NewValue: Smallint;
1468 Direction: TUpDownDirection);
1469begin
1470 if FUpdating or (not FInitialized) then exit;
1471 if ListHasData(IntToStr(NewValue), IdxSeq) then
1472 begin
1473 AllowChange := FALSE;
1474 case Direction of
1475 updUp: udSeq.Position := NewValue + 1;
1476 updDown: udSeq.Position := NewValue - 1;
1477 end;
1478 end;
1479end;
1480
1481procedure TfrmRemCoverSheet.sbCopyLeftClick(Sender: TObject);
1482var
1483 idx, Index, i: integer;
1484 tmpSL: TORStringList;
1485
1486begin
1487 if assigned(lvCover.Selected) then
1488 begin
1489 tmpSL := GetCurrent(FEditingIEN, FEditingLevel, FALSE);
1490 if assigned(tmpSL) then
1491 begin
1492 Idx := GetIndex(tmpSL, lvCover.Selected);
1493 Index := lvCover.Selected.Index;
1494 if Idx >= 0 then
1495 begin
1496 tmpSL.Delete(Idx);
1497 MarkListAsChanged;
1498 UpdateMasterListView;
1499 if lvCover.Items.Count > 0 then
1500 begin
1501 if Index > 0 then
1502 dec(Index);
1503 for i := 0 to lvCover.Items.Count-1 do
1504 if lvCover.Items[i].Index = Index then
1505 begin
1506 lvCover.Selected := lvCover.Items[i];
1507 break;
1508 end;
1509 end;
[830]1510 if ScreenReaderSystemActive then
1511 GetScreenReader.Speak('Reminder Removed from ' + DataName[FEditingLevel] + ' Level Reminders List');
[456]1512 end;
1513 end;
[830]1514 if sbCopyLeft.Enabled and (not sbCopyLeft.Focused) then
1515 sbCopyLeft.SetFocus;
[456]1516 end;
1517end;
1518
1519procedure TfrmRemCoverSheet.tvAllDblClick(Sender: TObject);
1520begin
1521 if sbCopyRight.Enabled then
1522 sbCopyRight.Click;
1523end;
1524
1525procedure TfrmRemCoverSheet.btnApplyClick(Sender: TObject);
1526begin
1527 SaveData(TRUE);
1528 btnApply.Enabled := FALSE;
1529end;
1530
1531procedure TfrmRemCoverSheet.btnOKClick(Sender: TObject);
1532begin
1533 SaveData(FALSE);
1534end;
1535
[1679]1536procedure TfrmRemCoverSheet.btnOKExit(Sender: TObject);
1537begin
1538 inherited;
1539 //TDP - CQ#19733 On ShiftTab from btnOK, go to sbCopyRight if no data in lvCover
1540 if ShiftTabIsPressed() then
1541 begin
1542 if not ScreenReaderSystemActive then
1543 begin
1544 if lvCover.Items.Count = 0 then sbCopyRight.SetFocus;
1545 end;
1546 end;
1547end;
1548
[456]1549procedure TfrmRemCoverSheet.SaveData(FromApply: boolean);
1550var
1551 i, j: integer;
1552 tmpSL: TORStringList;
1553 DeleteIt, DoRefresh: boolean;
1554 Level, lvl: TRemCoverDataLevel;
1555 ALevel, AClass, Code, IEN: string;
1556
1557begin
1558 DoRefresh := FALSE;
1559 i := 0;
1560 while (i < FData.Count) do
1561 begin
1562 DeleteIt := FALSE;
1563 if(Piece(FData[i],U,2) = BoolChar[TRUE]) then
1564 begin
1565 tmpSL := TORStringList(FData.Objects[i]);
1566 if assigned(tmpSL) then
1567 begin
1568 Level := dlPackage;
1569 Code := copy(FData[i],1,1);
1570 for lvl := low(TRemCoverDataLevel) to high(TRemCoverDataLevel) do
1571 begin
1572 if DataCode[lvl] = Code then
1573 begin
1574 Level := lvl;
1575 break;
1576 end;
1577 end;
1578 if Level <> dlPackage then
1579 begin
1580 IEN := copy(Piece(FData[i],U,1),2,MaxInt);
1581 ALevel := InternalName[Level];
1582 ACLass := '';
1583 case Level of
1584 dlDivision, dlService, dlLocation, dlUser:
1585 ALevel := ALevel + '.`' + IEN;
1586 dlUserClass:
1587 AClass := IEN;
1588 end;
1589 for j := 0 to tmpSL.Count-1 do
1590 tmpSL[j] := pieces(tmpSL[j],U,1,2);
1591 SetCoverSheetLevelData(ALevel, AClass, tmpSL);
1592 tmpSL.Free;
1593 DeleteIt := TRUE;
1594 FDataSaved := TRUE;
1595 DoRefresh := TRUE;
1596 end;
1597 end;
1598 end;
1599 if DeleteIt then
1600 FData.Delete(i)
1601 else
1602 inc(i);
1603 end;
1604 if FromApply and DoRefresh then
1605 UpdateMasterListView;
1606end;
1607
1608procedure TfrmRemCoverSheet.lvCoverDblClick(Sender: TObject);
1609begin
1610 if sbCopyLeft.Enabled then
1611 sbCopyLeft.Click;
1612end;
1613
[830]1614procedure TfrmRemCoverSheet.lvViewChange(Sender: TObject; Item: TListItem;
1615 Change: TItemChange);
1616begin
1617 lvViewSelectItem(Sender, Item, FALSE);
1618end;
1619
1620procedure TfrmRemCoverSheet.lvViewSelectItem(Sender: TObject; Item: TListItem;
1621 Selected: Boolean);
[456]1622var
1623 lvl: TRemCoverDataLevel;
1624 i: integer;
1625 ClsName, TIEN, IEN, lvlName: string;
1626 ok: boolean;
1627
1628begin
1629 if assigned(lvView.Selected) and (not FUpdatingView) then
1630 begin
1631 FUpdatingView := TRUE;
1632 try
1633 lvl := TRemCoverDataLevel(StrToIntDef(lvView.Selected.SubItems[IdxLvl2],ord(dlUser)));
1634 IEN := lvView.Selected.SubItems[IdxIEN];
1635 lvlName := lvView.Selected.SubItems[IdxLvl];
1636 TIEN := lvView.Selected.SubItems[IdxTIEN];
1637 ClsName := lvView.Selected.SubItems[IdxType];
1638 ok := (lvl <> FEditingLevel);
1639 if(not ok) and (lvl = dlUserClass) then
1640 ok := (FEditingIEN <> StrToIntDef(TIEN,0));
1641 if (not FUserMode) and ok and (lvl <> dlPackage) then
1642 begin
1643 case lvl of
1644 dlSystem: FUpdatePending := cbSystem;
1645 dlDivision: FUpdatePending := cbDivision;
1646 dlService: FUpdatePending := cbService;
1647 dlLocation: FUpdatePending := cbLocation;
1648 dlUserClass: FUpdatePending := cbUserClass;
1649 dlUser: FUpdatePending := cbUser;
1650 end;
1651 if lvl = dlUserClass then
1652 begin
1653 cbxClass.InitLongList(ClsName);
1654 cbxClass.SelectByID(TIEN);
1655 FCurClass := cbxClass.ItemIEN;
1656 end;
1657 cbxDropDownClose(nil);
1658 end;
1659 if (lvl = FEditingLevel) then
1660 begin
1661 for i := 0 to lvCover.Items.Count-1 do
1662 if IEN = lvCover.Items[i].SubItems[IdxIEN] then
1663 begin
1664 lvCover.Selected := lvCover.Items[i];
1665 break;
1666 end;
1667 end;
1668 for i := 0 to lvView.Items.Count-1 do
1669 begin
1670 if (IEN = lvView.Items[i].SubItems[IdxIEN]) and
1671 (lvlName = lvView.Items[i].SubItems[IdxLvl]) then
1672 begin
1673 lvView.Selected := lvView.Items[i];
1674 break;
1675 end;
1676 end;
1677 finally
1678 FUpdatingView := FALSE;
1679 end;
1680 end;
1681end;
1682
1683function TfrmRemCoverSheet.RPad(Str: String): String;
1684begin
1685 Result := StringOfChar('0',7-length(Str)) + Str;
1686end;
1687
1688procedure TfrmRemCoverSheet.btnViewClick(Sender: TObject);
1689var
1690 frmRemCoverPreview: TfrmRemCoverPreview;
1691 CurSortOrder: integer;
1692 CurSortDir: boolean;
1693 i, idx, SeqCnt: integer;
1694 Lvl, LastLvl, tmp, AddCode, IEN, Seq, SortID: string;
1695 RemList, LvlList: TORStringList; // IEN^Name^Seq^SortID^Locked
1696 ANode: TTreeNode;
1697
1698 procedure GetAllChildren(PNode: TTreeNode; const ASeq, ASortID: string);
1699 var
1700 Node: TTreeNode;
1701
1702 begin
1703 PNode.Expand(FALSE);
1704 Node := PNode.GetFirstChild;
1705 while assigned(Node) do
1706 begin
1707 tmp := TORTreeNode(Node).StringData;
1708 if copy(tmp,1,1) = CVCatCode then
1709 GetAllChildren(Node, ASeq, ASortID)
1710 else
1711 begin
1712 if RemList.IndexOfPiece(Piece(tmp,u,1)) < 0 then
1713 begin
1714 SetPiece(tmp,u,3,ASeq);
1715 inc(SeqCnt);
1716 SortID := copy(ASortID,1,7) + RPad(IntToStr(SeqCnt)) + copy(ASortID,15,MaxInt);
1717 SetPiece(tmp,u,4,SortID);
1718 RemList.Add(tmp);
1719 end;
1720 end;
1721 Node := Node.GetNextSibling;
1722 end;
1723 end;
1724
1725begin
[830]1726 Screen.OnActiveControlChange := fOldFocusChanged;
[456]1727 try
[830]1728 frmRemCoverPreview := TfrmRemCoverPreview.Create(Application);
[456]1729 try
[830]1730 CurSortOrder := FTopSortTag;
1731 CurSortDir := FTopSortUp;
1732 lvView.Items.BeginUpdate;
[456]1733 try
[830]1734 FTopSortTag := 3;
1735 FTopSortUp := TRUE;
1736 lvView.CustomSort(nil, 0);
1737 RemList := TORStringList.Create;
[456]1738 try
[830]1739 LvlList := TORStringList.Create;
1740 try
1741 LastLvl := '';
1742 for i := 0 to lvView.Items.Count-1 do
[456]1743 begin
[830]1744 Lvl := lvView.Items[i].SubItems[IdxLvl2];
1745 if LvL <> LastLvl then
[456]1746 begin
[830]1747 RemList.AddStrings(LvlList);
1748 LvlList.Clear;
1749 LastLvl := Lvl;
1750 end;
1751 IEN := lvView.Items[i].SubItems[IdxIEN];
1752 AddCode := lvView.Items[i].SubItems[IdxAdd];
1753 idx := RemList.IndexOfPiece(IEN);
1754 if AddCode = CVRemoveCode then
1755 begin
1756 if(idx >= 0) and (piece(RemList[idx],U,5) <> '1') then
1757 RemList.Delete(idx);
[456]1758 end
1759 else
1760 begin
[830]1761 if idx < 0 then
1762 begin
1763 Seq := lvView.Items[i].SubItems[IdxSeq];
1764 SortID := RPad(Seq) + '0000000' + lvl + copy(lvView.Items[i].SubItems[IdxTIEN] + '0000000000',1,10);
1765 tmp := IEN + U + lvView.Items[i].Caption + U + Seq + U + SortID;
1766 if AddCode = CVLockCode then
1767 tmp := tmp + U + '1';
1768 RemList.Add(tmp);
1769 end
1770 else
1771 if (AddCode = CVLockCode) and (piece(RemList[idx],U,5) <> '1') then
1772 begin
1773 tmp := RemList[idx];
1774 SetPiece(tmp,U,5,'1');
1775 RemList[idx] := tmp;
1776 end;
[456]1777 end;
1778 end;
[830]1779 RemList.AddStrings(LvlList);
1780 FTopSortTag := CurSortOrder;
1781 FTopSortUp := CurSortDir;
1782 lvView.CustomSort(nil, 0);
[456]1783
[830]1784 LvlList.Clear;
1785 //LvlList.Assign(RemList);
1786 FastAssign(RemList, LvlList);
1787 RemList.Clear;
1788 FInternalExpansion := TRUE;
1789 try
1790 for i := 0 to LvlList.Count-1 do
[456]1791 begin
[830]1792 IEN := piece(LvlList[i],U,1);
1793 if (copy(LvlList[i],1,1) = CVCatCode) then
[456]1794 begin
[830]1795 ANode := tvAll.Items.GetFirstNode;
1796 while assigned(ANode) do
[456]1797 begin
[830]1798 if IEN = piece(TORTreeNode(ANode).StringData,U,1) then
1799 begin
1800 SeqCnt := 0;
1801 GetAllChildren(ANode, Piece(LvlList[i], U, 3), Piece(LvlList[i], U, 4));
1802 ANode := nil;
1803 end
1804 else
1805 ANode := ANode.GetNextSibling;
1806 end;
1807 end
1808 else
1809 if RemList.IndexOfPiece(IEN) < 0 then
1810 RemList.Add(LvlList[i]);
1811 end;
1812 finally
1813 FInternalExpansion := FALSE;
[456]1814 end;
1815 finally
[830]1816 LvlList.Free;
[456]1817 end;
1818
[830]1819 RemList.SortByPiece(4);
1820 for i := 0 to RemList.Count-1 do
[456]1821 begin
[830]1822 with frmRemCoverPreview.lvMain.Items.Add do
1823 begin
1824 tmp := RemList[i];
1825 Caption := Piece(tmp, U, 2);
1826 SubItems.Add(Piece(tmp, U, 3));
1827 SubItems.Add(Piece(tmp, U, 4));
1828 end;
[456]1829 end;
[830]1830 finally
1831 RemList.Free;
[456]1832 end;
1833 finally
[830]1834 lvView.Items.EndUpdate;
[456]1835 end;
[830]1836 frmRemCoverPreview.ShowModal;
[456]1837 finally
[830]1838 frmRemCoverPreview.Free;
[456]1839 end;
1840 finally
[830]1841 Screen.OnActiveControlChange := ActiveControlChanged;
[456]1842 end;
1843end;
1844
[1679]1845procedure TfrmRemCoverSheet.btnViewExit(Sender: TObject);
1846begin
1847 inherited;
1848 //TDP - CQ#19733 Corrected tabbing issues
1849 if TabIsPressed() then
1850 begin
1851 if ScreenReaderSystemActive then lblCAC.SetFocus
1852 else begin
1853 if pnlUser.Visible then cbxUserLoc.SetFocus
1854 else cbSystem.SetFocus;
1855 end;
1856 end;
1857 if ShiftTabIsPressed() then lvView.SetFocus;
1858end;
1859
[456]1860procedure TfrmRemCoverSheet.lvCoverKeyDown(Sender: TObject; var Key: Word;
1861 Shift: TShiftState);
1862begin
1863 if (Key = VK_DELETE) and sbCopyLeft.Enabled then
[830]1864 sbCopyLeft.Click;
[456]1865end;
1866
1867procedure TfrmRemCoverSheet.edtSeqKeyPress(Sender: TObject; var Key: Char);
1868begin
1869 if (Key < '0') or (Key > '9') then
[830]1870 Key := #0;
[456]1871end;
1872
1873procedure TfrmRemCoverSheet.cbxDivisionKeyDown(Sender: TObject;
1874 var Key: Word; Shift: TShiftState);
1875begin
[830]1876 if (Key = VK_RETURN) and TORComboBox(Sender).DroppedDown then
1877 TORComboBox(Sender).DroppedDown := FALSE;
[456]1878end;
1879
1880function TfrmRemCoverSheet.GetCoverSheetLvlData(ALevel,
1881 AClass: string): TStrings;
1882var
1883 IEN: string;
1884 i, j: integer;
1885
1886begin
1887 Result := GetCoverSheetLevelData(ALevel, AClass);
1888 for i := 0 to Result.Count-1 do
1889 begin
1890 IEN := copy(piece(Result[i],U,2),2,MaxInt);
1891 j := FMasterList.IndexOfPiece(IEN);
1892 if j >= 0 then
1893 Result[i] := Result[i] + piece(FMasterList[j],U,3);
1894 end;
1895end;
1896
[830]1897procedure TfrmRemCoverSheet.SetButtonHints;
1898{This procedure sets the Lock, Add, and Remove button hints based on the
1899 selected parameter level}
1900begin
1901 if FEditingLevel = dlDivision then
1902 begin
1903 btnLock.hint := 'Adds Reminder to the Coversheet display and Locks the Reminder'
1904 + CRLF + 'so it can not be removed from the Coversheet display at any'
1905 + CRLF + 'of the lower levels (Service, Location, User Class, User).';
1906 btnRemove.hint := 'Removes Reminders from the Coversheet display. Will not'
1907 + CRLF + 'remove Reminders which are locked at the System level.';
1908 btnAdd.hint := 'Adds Reminders to the Coversheet at the Division level and'
1909 + CRLF + 'below. It also removes the lock from a Reminder locked at'
1910 + CRLF + 'the Division level while leaving the Reminder on the Coversheet.';
1911 end
1912 else if FEditingLevel = dlService then
1913 begin
1914 btnLock.hint := 'Adds Reminder to the Coversheet display and Locks the Reminder'
1915 + CRLF + 'so it can not be removed from the Coversheet display at any of'
1916 + CRLF + 'the lower levels (Location, User Class, User).';
1917 btnRemove.hint := 'Removes Reminders from the Coversheet display. Will not'
1918 + CRLF + 'remove Reminders which are locked at the Division level or higher.';
1919 btnAdd.hint := 'Adds Reminders to the Coversheet at the Service level and'
1920 + CRLF + 'below. It also removes the lock from a Reminder locked at the'
1921 + CRLF + 'Service level while leaving the Reminder on the Coversheet.';
1922 end
1923 else if FEditingLevel = dlLocation then
1924 begin
1925 btnLock.hint := 'Adds Reminder to the Coversheet display and Locks the Reminder'
1926 + CRLF + 'so it can not be removed from the Coversheet display at any of'
1927 + CRLF + 'the lower levels (User Class, User).';
1928 btnRemove.hint := 'Removes Reminders from the Coversheet display. Will not'
1929 + CRLF + 'remove Reminders which are locked at the Service level or higher.';
1930 btnAdd.hint := 'Adds Reminders to the Coversheet at the Location level and'
1931 + CRLF + 'below. It also removes the lock from a Reminder locked at the'
1932 + CRLF + 'Location level while leaving the Reminder on the Coversheet.';
1933 end
1934 else if FEditingLevel = dlUserClass then
1935 begin
1936 btnLock.hint := 'Adds Reminder to the Coversheet display and Locks the Reminder so'
1937 + CRLF + 'it can not be removed from the Coversheet display at the User level.';
1938 btnRemove.hint := 'Removes Reminders from the Coversheet display. Will not remove'
1939 + CRLF + 'Reminders which are locked at the Location level or higher.';
1940 btnAdd.hint := 'Adds Reminders to the Coversheet at the User Class level and'
1941 + CRLF + 'below. It also removes the lock from a Reminder locked at the'
1942 + CRLF + 'User Class level while leaving the Reminder on the Coversheet.';
1943 end
1944 else if FEditingLevel = dlUser then
1945 begin
1946 btnRemove.hint := 'Removes Reminders from the Coversheet display. Will not'
1947 + CRLF + 'remove Reminders which are locked at the User Class level'
1948 + CRLF + 'or higher.';
1949 btnAdd.hint := 'Adds Reminders to the Coversheet at the User level.';
1950 end
1951 else
1952 begin
1953 btnLock.hint := 'Adds Reminder to the Coversheet display and Locks the Reminder'
1954 + CRLF + 'so it can not be removed from the Coversheet display at any of'
1955 + CRLF + 'the lower levels (Division, Service, Location, User Class, User).';
1956 btnRemove.hint := 'Removes Reminders from the Coversheet display.';
1957 btnAdd.hint := 'Adds Reminders to the Coversheet at the System level and'
1958 + CRLF + 'below. It also removes the lock from a Reminder locked at the'
1959 + CRLF + 'System level while leaving the Reminder on the Coversheet.';
1960 end;
1961end;
1962
1963procedure TfrmRemCoverSheet.FormCreate(Sender: TObject);
1964begin
1965 FSavePause := Application.HintHidePause; //Save Hint Pause setting
1966 Application.HintHidePause := 20000; //Reset Hint Pause to 20 seconds
1967 mlgnLock.hint := 'Lock a Reminder to prevent it''s removal from a lower'
1968 + CRLF + 'level Coversheet display. For example, if you lock'
1969 + CRLF + 'a Reminder at the Service level, then that Reminder'
1970 + CRLF + 'can not be removed from the coversheet display at'
1971 + CRLF + 'the Location, User Class, or User levels.';
1972 fOldFocusChanged := Screen.OnActiveControlChange;
1973 Screen.OnActiveControlChange := ActiveControlChanged;
1974end;
1975
1976procedure TfrmRemCoverSheet.ActiveControlChanged(Sender: TObject);
1977begin
1978 if assigned(fOldFocusChanged) then fOldFocusChanged(Sender);
1979 UpdateButtons;
1980end;
1981
1982procedure TfrmRemCoverSheet.LockButtonUpdate(Data, FNAME, Hint: string);
1983begin
1984 btnLock.Caption := Data;
1985 btnLock.Glyph.LoadFromResourceName(hinstance, FNAME);
1986 if btnLock.Hint <> Hint then btnLock.Hint := Hint;
1987 if FNAME = 'BMP_LOCK' then btnLock.OnClick := btnLockClick
1988 else
1989 btnLock.OnClick := btnAddClick;
1990end;
1991
[456]1992end.
Note: See TracBrowser for help on using the repository browser.