source: cprs/trunk/CPRS-Chart/fReminderTree.pas@ 730

Last change on this file since 730 was 456, checked in by Kevin Toppenberg, 16 years ago

Initial Upload of Official WV CPRS 1.0.26.76

File size: 19.5 KB
Line 
1unit fReminderTree;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 StdCtrls, ORCtrls, ExtCtrls, ComCtrls, ImgList, ORFn, Menus;
8
9type
10 TfrmReminderTree = class(TForm)
11 pnlTop: TPanel;
12 tvRem: TORTreeView;
13 hcRem: THeaderControl;
14 pnlTopRight: TPanel;
15 bvlGap: TBevel;
16 lbRem: TORListBox;
17 mmMain: TMainMenu;
18 memAction: TMenuItem;
19 memEvalAll: TMenuItem;
20 memEval: TMenuItem;
21 N2: TMenuItem;
22 memRefresh: TMenuItem;
23 memEvalCat: TMenuItem;
24 mnuCoverSheet: TMenuItem;
25 mnuExit: TMenuItem;
26 procedure FormClose(Sender: TObject; var Action: TCloseAction);
27 procedure FormCreate(Sender: TObject);
28 procedure tvRemExpanded(Sender: TObject; Node: TTreeNode);
29 procedure tvRemCollapsed(Sender: TObject; Node: TTreeNode);
30 procedure pnlTopResize(Sender: TObject);
31 procedure lbRemDrawItem(Control: TWinControl; Index: Integer;
32 Rect: TRect; State: TOwnerDrawState);
33 procedure lbRemChange(Sender: TObject);
34 procedure lbRemClick(Sender: TObject);
35 procedure tvRemEnter(Sender: TObject);
36 procedure tvRemExit(Sender: TObject);
37 procedure hcRemSectionClick(HeaderControl: THeaderControl;
38 Section: THeaderSection);
39 procedure tvRemClick(Sender: TObject);
40 procedure tvRemChange(Sender: TObject; Node: TTreeNode);
41 procedure tvRemMouseDown(Sender: TObject; Button: TMouseButton;
42 Shift: TShiftState; X, Y: Integer);
43 procedure memEvalClick(Sender: TObject);
44 procedure memEvalAllClick(Sender: TObject);
45 procedure FormDestroy(Sender: TObject);
46 procedure memRefreshClick(Sender: TObject);
47 procedure memActionClick(Sender: TObject);
48 procedure memEvalCatClick(Sender: TObject);
49 procedure mnuCoverSheetClick(Sender: TObject);
50 procedure tvRemNodeCaptioning(Sender: TObject; var Caption: String);
51 procedure tvRemAddition(Sender: TObject; Node: TTreeNode);
52 procedure tvRemDeletion(Sender: TObject; Node: TTreeNode);
53 procedure mnuExitClick(Sender: TObject);
54 private
55 FLinking: boolean;
56 FSortOrder: integer;
57 FSortAssending: boolean;
58 FSorting: boolean;
59 FUpdating: boolean;
60 memView: TORMenuItem;
61 DateColWidth: integer;
62 LastDateColWidth: integer;
63 PriorityColWidth: integer;
64 procedure SetRemHeaderSectionWidth( SectionIndex: integer; NewWidth: integer);
65 protected
66 procedure Resync(FromTree: boolean);
67 procedure RemindersChanged(Sender: TObject);
68 procedure ResetlbItems(RootNode: TTreeNode);
69 procedure LinkTopControls(FromTree: boolean);
70 procedure SyncTopControls(FromTree: boolean);
71 procedure SortNode(const Node: TTreeNode);
72 function SortData(Node: TORTreeNode): string;
73// procedure PositionToReminder(Sender: TObject);
74 procedure ProcessedRemindersChanged(Sender: TObject);
75 public
76 procedure EnableActions;
77 procedure SetFontSize( NewFontSize: integer);
78 end;
79
80procedure ViewReminderTree;
81
82var
83 frmReminderTree: TfrmReminderTree = nil;
84 RemTreeDlgLeft: integer = 0;
85 RemTreeDlgTop: integer = 0;
86 RemTreeDlgWidth: integer = 0;
87 RemTreeDlgHeight: integer = 0;
88
89const
90 ReminderTreeName = 'frmReminderTree';
91
92implementation
93
94uses uReminders, dShared, uConst, fReminderDialog, fNotes, rMisc,
95 rReminders, fRemCoverSheet, uAccessibleTreeView, uAccessibleTreeNode;
96
97{$R *.DFM}
98
99const
100 UnscaledDateColWidth = 70;
101 UnscaledLastDateColWidth = 89;
102 UnscaledPriorityColWidth = 43;
103
104procedure ViewReminderTree;
105
106begin
107 if(not InitialRemindersLoaded) then
108 StartupReminders;
109 if(not assigned(frmReminderTree)) then
110 frmReminderTree := TfrmReminderTree.Create(Application);
111 frmReminderTree.Show;
112end;
113
114procedure TfrmReminderTree.FormClose(Sender: TObject;
115 var Action: TCloseAction);
116begin
117 Action := caFree;
118end;
119
120procedure TfrmReminderTree.FormCreate(Sender: TObject);
121begin
122 memView := TORMenuItem.Create(mmMain);
123 memView.Caption := '&View';
124 memView.Add(TORMenuItem.Create(memView));
125 mmMain.Items.Insert(0, memView);
126
127 bvlGap.Height := GetSystemMetrics(SM_CYHSCROLL);
128 FSortOrder := -1;
129 FSortAssending := TRUE;
130 SetReminderMenuSelectRoutine(memView);
131 NotifyWhenRemindersChange(RemindersChanged);
132// NotifyWhenProcessingReminderChanges(PositionToReminder);
133 ProcessedReminders.Notifier.NotifyWhenChanged(ProcessedRemindersChanged);
134 SetFontSize(MainFontSize);
135 SetReminderFormBounds(Self, 0, 0, Self.Width, Self.Height,
136 RemTreeDlgLeft, RemTreeDlgTop, RemTreeDlgWidth, RemTreeDlgHeight);
137 TAccessibleTreeView.WrapControl(tvRem);
138end;
139
140procedure TfrmReminderTree.LinkTopControls(FromTree: boolean);
141var
142 idx: integer;
143
144begin
145 if(not FLinking) then
146 begin
147 FLinking := TRUE;
148 try
149 if(FromTree) then
150 begin
151 if(assigned(tvRem.Selected)) then
152 begin
153 idx := lbRem.Items.IndexOfObject(tvRem.Selected);
154 lbRem.ItemIndex := idx;
155 end
156 else
157 lbRem.ItemIndex := -1;
158 end
159 else
160 begin
161 if(lbRem.ItemIndex < 0) then
162 tvRem.Selected := nil
163 else
164 tvRem.Selected := TTreeNode(lbRem.Items.Objects[lbRem.ItemIndex]);
165 end;
166 finally
167 FLinking := FALSE;
168 end;
169 end;
170end;
171
172procedure TfrmReminderTree.RemindersChanged(Sender: TObject);
173const
174 ARTxt = 'Available Reminders';
175
176var
177 OldUpdating: boolean;
178
179begin
180 EnableActions;
181 if(GetReminderStatus = rsNone) then
182 begin
183 tvRem.Selected := nil;
184 Close;
185 exit;
186 end;
187 OldUpdating := FUpdating;
188 try
189 FUpdating := TRUE;
190 lbRem.Items.BeginUpdate;
191 try
192 try
193 BuildReminderTree(tvRem);
194 lbRem.Clear;
195 ResetlbItems(nil);
196 LinkTopControls(TRUE);
197 SyncTopControls(TRUE);
198 pnlTopResize(Self);
199 finally
200 FUpdating := FALSE;
201 tvRem.Invalidate;
202 lbRem.Invalidate;
203 end;
204 if(RemindersEvaluatingInBackground) then
205 hcRem.Sections[0].Text := ARTxt + ' (Evaluating Reminders...)'
206 else
207 hcRem.Sections[0].Text := ARTxt;
208 finally
209 lbRem.Items.EndUpdate;
210 end;
211 finally
212 FUpdating := OldUpdating;
213 end;
214end;
215
216procedure TfrmReminderTree.ResetlbItems(RootNode: TTreeNode);
217var
218 Firsti, i: integer;
219 First, Node: TTreeNode;
220 sl: TStringList;
221 lvl: integer;
222 Add2LB: boolean;
223 Tmp, Data: string;
224
225 function IsVis(Node: TTreeNode): boolean; // IsVisible doesn't work when updating
226 begin
227 Result := TRUE;
228 Node := Node.Parent;
229 while(Result and (assigned(Node))) do
230 begin
231 Result := Node.Expanded;
232 Node := Node.Parent;
233 end;
234 end;
235
236begin
237 if(not FSorting) then
238 begin
239 if(assigned(RootNode)) then
240 begin
241 Node := RootNode.GetFirstChild;
242 lvl := RootNode.Level;
243 Add2LB := RootNode.Expanded;
244 Firsti := lbRem.Items.IndexOfObject(RootNode)+1;
245 end
246 else
247 begin
248 Node := tvRem.Items.GetFirstNode;
249 lvl := -1;
250 Add2LB := TRUE;
251 Firsti := 0;
252 end;
253 First := Node;
254 if(assigned(Node)) then
255 begin
256 sl := TStringList.Create;
257 try
258 sl.Assign(lbRem.Items);
259 while(assigned(Node) and (Node.Level > lvl)) do
260 begin
261 i := sl.IndexOfObject(Node);
262 if(i >= 0) then
263 sl.Delete(i);
264 Node := Node.GetNext;
265 end;
266 if(Add2LB) then
267 begin
268 i := Firsti;
269 Node := First;
270 while(assigned(Node) and (Node.Level > lvl)) do
271 begin
272 if(IsVis(Node)) then
273 begin
274 Tmp := TORTreeNode(Node).StringData;
275 Data := Piece(Tmp,U,RemTreeDateIdx) + U + Piece(Tmp,U,RemTreeDateIdx+1) + U +
276 RemPriorityText[StrToIntDef(Piece(Tmp, U, 5), 2)];
277 sl.InsertObject(i, Data, Node);
278 inc(i);
279 end;
280 Node := Node.GetNext;
281 end;
282 end;
283 lbRem.Items.Assign(sl);
284 finally
285 sl.Free;
286 end;
287 end;
288 end;
289end;
290
291procedure TfrmReminderTree.SyncTopControls(FromTree: boolean);
292begin
293 if(lbRem.Items.Count > 0) and (tvRem.TopItem <> lbRem.Items.Objects[lbRem.TopIndex]) then
294 begin
295 if(FromTree) then
296 lbRem.TopIndex := lbRem.Items.IndexOfObject(tvRem.TopItem)
297 else
298 tvRem.TopItem := TTreeNode(lbRem.Items.Objects[lbRem.TopIndex]);
299 end;
300end;
301
302procedure TfrmReminderTree.tvRemExpanded(Sender: TObject; Node: TTreeNode);
303begin
304 if(FUpdating) then exit;
305 FUpdating := TRUE;
306 try
307 ResetlbItems(Node);
308 pnlTopResize(Self);
309 finally
310 FUpdating := FALSE;
311 end;
312end;
313
314procedure TfrmReminderTree.tvRemCollapsed(Sender: TObject;
315 Node: TTreeNode);
316begin
317 if(FUpdating) then exit;
318 FUpdating := TRUE;
319 try
320 ResetlbItems(Node);
321 pnlTopResize(Self);
322 finally
323 FUpdating := FALSE;
324 end;
325end;
326
327procedure TfrmReminderTree.pnlTopResize(Sender: TObject);
328var
329 Tmp,Adj: integer;
330
331begin
332 Tmp := DateColWidth + LastDateColWidth + PriorityColWidth + 4;
333 if(lbRem.Width <> (lbRem.ClientWidth + 4)) then
334 Adj := ScrollBarWidth
335 else
336 Adj := 0;
337 pnlTopRight.Width := Tmp + Adj;
338 Tmp := pnlTop.Width - DateColWidth - LastDateColWidth - PriorityColWidth - 2 - Adj;
339 SetRemHeaderSectionWidth( 0, Tmp);
340 tvRem.Items.BeginUpdate;
341 try
342 tvRem.Height := pnlTop.Height - hcRem.Height;
343 if(tvRem.Width <> (tvRem.ClientWidth+4)) then
344 inc(Tmp, ScrollBarWidth);
345 tvRem.Width := Tmp;
346 finally
347 tvRem.Items.EndUpdate;
348 end;
349 bvlGap.Visible := (tvRem.Height <> (tvRem.ClientHeight+4));
350end;
351
352procedure TfrmReminderTree.lbRemDrawItem(Control: TWinControl;
353 Index: Integer; Rect: TRect; State: TOwnerDrawState);
354var
355 Tmp: string;
356 Flags: Longint;
357
358begin
359 SyncTopControls(FALSE);
360 if (odSelected in State) then
361 begin
362 if((ActiveControl = lbRem) or (ActiveControl = tvRem)) then
363 begin
364 lbRem.Canvas.Brush.Color := clHighlight;
365 lbRem.Canvas.Font.Color := clHighlightText
366 end
367 else
368 begin
369 lbRem.Canvas.Brush.Color := clInactiveBorder;
370 lbRem.Canvas.Font.Color := clWindowText;
371 end;
372 end;
373 Flags := lbRem.DrawTextBiDiModeFlags(DT_SINGLELINE or DT_VCENTER);
374 Tmp := piece(lbRem.Items[Index],U,1);
375 lbRem.Canvas.FillRect(Rect);
376 Inc(Rect.Left, 6);
377 DrawText(lbRem.Canvas.Handle, PChar(Tmp), Length(Tmp), Rect, Flags);
378 inc(Rect.Left, DateColWidth);
379 Tmp := piece(lbRem.Items[Index],U,2);
380 DrawText(lbRem.Canvas.Handle, PChar(Tmp), Length(Tmp), Rect, Flags);
381 inc(Rect.Left, LastDateColWidth);
382 Tmp := piece(lbRem.Items[Index],U,3);
383 DrawText(lbRem.Canvas.Handle, PChar(Tmp), Length(Tmp), Rect, Flags);
384end;
385
386procedure TfrmReminderTree.lbRemChange(Sender: TObject);
387begin
388 Resync(FALSE);
389 tvRem.SetFocus;
390end;
391
392procedure TfrmReminderTree.lbRemClick(Sender: TObject);
393begin
394 tvRem.SetFocus;
395end;
396
397procedure TfrmReminderTree.tvRemEnter(Sender: TObject);
398begin
399 if(FUpdating) then exit;
400 if(ActiveControl = lbRem) or (ActiveControl = tvRem) then
401 lbRem.Invalidate;
402end;
403
404procedure TfrmReminderTree.tvRemExit(Sender: TObject);
405begin
406 if(FUpdating) then exit;
407 if(ActiveControl <> lbRem) and (ActiveControl <> tvRem) then
408 lbRem.Invalidate;
409end;
410
411procedure TfrmReminderTree.hcRemSectionClick(HeaderControl: THeaderControl;
412 Section: THeaderSection);
413var
414 i, SortIdx: integer;
415 exp: boolean;
416 Sel, Node: TTreeNode;
417
418begin
419 SortIdx := -1;
420 for i := 0 to 3 do
421 begin
422 if(Section = hcRem.Sections[i]) then
423 begin
424 SortIdx := i;
425 break;
426 end;
427 end;
428 if(SortIdx >= 0) then
429 begin
430 Sel := tvRem.Selected;
431 if(FSortOrder = SortIdx) then
432 FSortAssending := not FSortAssending
433 else
434 FSortOrder := SortIdx;
435
436 FSorting := TRUE;
437 tvRem.Items.BeginUpdate;
438 try
439 Node := tvRem.Items.GetFirstNode;
440 while(assigned(Node)) do
441 begin
442 exp := Node.Expanded;
443 SortNode(Node);
444 if(Node.Expanded <> exp) then
445 Node.Expanded := exp;
446 Node := Node.GetNextSibling;
447 end;
448 finally
449 tvRem.Items.EndUpdate;
450 FSorting := FALSE;
451 end;
452 ResetlbItems(nil);
453 tvRem.Selected := Sel;
454 end;
455end;
456
457procedure TfrmReminderTree.SortNode(const Node: TTreeNode);
458var
459 i: integer;
460 sl: TStringList;
461 Tmp, TmpLast: TTreeNode;
462 exp: boolean;
463
464begin
465 if(Node.HasChildren) then
466 begin
467 sl := TStringList.Create;
468 try
469 Tmp := Node.GetFirstChild;
470 while assigned(Tmp) do
471 begin
472 sl.AddObject(SortData(TORTreeNode(Tmp)), Tmp);
473 Tmp := Tmp.GetNextSibling;
474 end;
475 sl.sort;
476 TmpLast := Node;
477 for i := 0 to sl.Count-1 do
478 begin
479 if(FSortAssending) then
480 Tmp := TTreeNode(sl.Objects[i])
481 else
482 Tmp := TTreeNode(sl.Objects[sl.Count-1-i]);
483 exp := Tmp.Expanded;
484 if(i = 0) then
485 Tmp.MoveTo(TmpLast, naAddChildFirst)
486 else
487 Tmp.MoveTo(TmpLast, naInsert);
488 TmpLast := Tmp;
489 SortNode(Tmp);
490 Tmp.Expanded := exp;
491 end;
492 finally
493 sl.Free;
494 end;
495 end;
496end;
497
498function TfrmReminderTree.SortData(Node: TORTreeNode): string;
499
500 function ZForm(str: string; Num: integer): string;
501 begin
502 Result := copy(StringOfChar('0', Num)+str,1+length(str),Num);
503 end;
504
505begin
506 Result := ZForm(piece(Node.StringData, U, RemTreeDateIdx+2),5);
507 case FSortOrder of
508 1: Result := ZForm(Piece(Node.StringData, U, 3), 15)+'.'+Result;
509 2: Result := ZForm(Piece(Node.StringData, U, 4), 15)+'.'+Result;
510 3: Result := Piece(Node.StringData, U, 5)+'.'+Result;
511 end;
512end;
513
514procedure TfrmReminderTree.tvRemClick(Sender: TObject);
515begin
516 Resync(TRUE);
517end;
518
519procedure TfrmReminderTree.tvRemChange(Sender: TObject; Node: TTreeNode);
520var
521 p1: string;
522
523begin
524 memView.Data := '';
525 if(assigned(Node)) then
526 begin
527 p1 := Piece((Node as TORTreeNode).StringData, U, 1);
528 if(Copy(p1,1,1) = RemCode) then
529 begin
530 memView.Data := (Node as TORTreeNode).StringData;
531 end;
532 end;
533 EnableActions;
534
535 Resync(TRUE);
536end;
537
538procedure TfrmReminderTree.tvRemMouseDown(Sender: TObject;
539 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
540begin
541 Resync(TRUE);
542end;
543
544procedure TfrmReminderTree.Resync(FromTree: boolean);
545begin
546 if(FUpdating) then exit;
547 FUpdating := TRUE;
548 try
549 LinkTopControls(FromTree);
550 SyncTopControls(FromTree);
551 finally
552 FUpdating := FALSE;
553 end;
554end;
555
556{procedure TfrmReminderTree.PositionToReminder(Sender: TObject);
557begin
558 if(assigned(Sender)) then
559 begin
560 if(Sender is TReminder) then
561 begin
562 tvRem.Selected := tvRem.FindPieceNode(RemCode + (Sender as TReminder).IEN, 1);
563 if(assigned(tvRem.Selected)) then
564 TORTreeNode(tvRem.Selected).EnsureVisible;
565 end;
566 end
567 else
568 tvRem.Selected := nil;
569end;}
570
571procedure TfrmReminderTree.memEvalClick(Sender: TObject);
572var
573 Node: TORTreeNode;
574 p1: string;
575
576begin
577 Node := TORTreeNode(tvRem.Selected);
578 if(assigned(Node)) then
579 begin
580 p1 := Piece(Node.StringData, U, 1);
581 if(Copy(p1,1,1) = RemCode) then
582 EvalReminder(StrToIntDef(Copy(p1,2,MaxInt),0));
583 end;
584end;
585
586procedure TfrmReminderTree.EnableActions;
587var
588 OK: boolean;
589 Node: TORTreeNode;
590 p1: string;
591
592begin
593 Node := TORTreeNode(tvRem.Selected);
594 if(assigned(Node)) then
595 p1 := Piece(Node.StringData, U, 1)
596 else
597 p1 := '';
598 if(assigned(Node)) then
599 OK := (Copy(p1,1,1) = RemCode)
600 else
601 OK := FALSE;
602 memEval.Enabled := OK;
603 memEvalAll.Enabled := (ProcessedReminders.Count > 0);
604 memRefresh.Enabled := (not ReminderDialogActive);
605 mnuCoverSheet.Enabled := (NewRemCoverSheetListActive or CanEditAllRemCoverSheetLists);
606 memAction.Enabled := (OK or memEvalAll.Enabled or memRefresh.Enabled or mnuCoverSheet.Enabled);
607 if(assigned(Node)) then
608 OK := ((Copy(p1,1,1) = CatCode) and (p1 <> OtherCatID) and (Node.HasChildren))
609 else
610 OK := FALSE;
611 memEvalCat.Enabled := OK;
612 memEvalCat.Tag := integer(Node);
613end;
614
615procedure TfrmReminderTree.ProcessedRemindersChanged(Sender: TObject);
616begin
617 EnableActions;
618end;
619
620procedure TfrmReminderTree.memEvalAllClick(Sender: TObject);
621begin
622 EvalProcessed;
623end;
624
625procedure TfrmReminderTree.FormDestroy(Sender: TObject);
626begin
627 TAccessibleTreeView.UnwrapControl(tvRem);
628 frmReminderTree := nil;
629 ProcessedReminders.Notifier.RemoveNotify(ProcessedRemindersChanged);
630// RemoveNotifyWhenProcessingReminderChanges(PositionToReminder);
631 RemoveNotifyRemindersChange(RemindersChanged);
632 RemTreeDlgLeft := Self.Left;
633 RemTreeDlgTop := Self.Top;
634 RemTreeDlgWidth := Self.Width;
635 RemTreeDlgHeight := Self.Height;
636end;
637
638procedure TfrmReminderTree.memRefreshClick(Sender: TObject);
639begin
640 KillObj(@ReminderDialogInfo, TRUE);
641 UpdateReminderDialogStatus;
642 EnableActions;
643end;
644
645procedure TfrmReminderTree.memActionClick(Sender: TObject);
646begin
647 EnableActions;
648end;
649
650procedure TfrmReminderTree.memEvalCatClick(Sender: TObject);
651begin
652 EvaluateCategoryClicked(nil, Sender);
653end;
654
655procedure TfrmReminderTree.mnuCoverSheetClick(Sender: TObject);
656begin
657 EditCoverSheetReminderList(not CanEditAllRemCoverSheetLists);
658end;
659
660procedure TfrmReminderTree.SetFontSize(NewFontSize: integer);
661var
662 TotalWidth: integer;
663begin
664 DateColWidth := ResizeWidth(Font, MainFont, UnscaledDateColWidth);
665 LastDateColWidth := ResizeWidth(Font, MainFont, UnscaledLastDateColWidth);
666 PriorityColWidth := ResizeWidth(Font, MainFont, UnscaledPriorityColWidth);
667 ResizeAnchoredFormToFont(self);
668 TotalWidth := hcRem.Width;
669 SetRemHeaderSectionWidth( 0, TotalWidth - DateColWidth - LastDateColWidth - PriorityColWidth);
670 SetRemHeaderSectionWidth( 1, DateColWidth);
671 SetRemHeaderSectionWidth( 2, LastDateColWidth);
672 SetRemHeaderSectionWidth( 3, PriorityColWidth);
673
674 lbRem.ItemHeight := ((Abs(Font.Height)+ 6) div 2)*2; //tvRem.ItemHeight;
675 //This is called "best guess calibration"
676 if Font.Size > 12 then lbRem.ItemHeight := lbRem.ItemHeight + 2;
677 //I am reluctant to use an alignment on the tvRem as there si lots of resizing
678 //tricks going on with the scroll bar at the bottom.
679 tvRem.Top := hcRem.Top+hcRem.Height;
680 pnlTopResize(self);
681end;
682
683procedure TfrmReminderTree.SetRemHeaderSectionWidth( SectionIndex: integer; NewWidth: integer);
684begin
685 hcRem.Sections[SectionIndex].MinWidth := 0;
686 hcRem.Sections[SectionIndex].MaxWidth := NewWidth;
687 hcRem.Sections[SectionIndex].MinWidth := NewWidth;
688 hcRem.Sections[SectionIndex].Width := NewWidth;
689end;
690
691procedure TfrmReminderTree.tvRemNodeCaptioning(Sender: TObject;
692 var Caption: String);
693var
694 StringData: string;
695begin
696 StringData := (Sender as TORTreeNode).StringData;
697 if (Length(StringData) > 0) and (StringData[1] = 'R') then //Only tag reminder statuses
698 case StrToIntDef(Piece(StringData,'^',6 {Due}),-1) of
699 0: Caption := Caption + ' -- Applicable';
700 1: Caption := Caption + ' -- DUE';
701 2: Caption := Caption + ' -- Not Applicable';
702 else Caption := Caption + ' -- Not Evaluated';
703 end;
704end;
705
706procedure TfrmReminderTree.tvRemAddition(Sender: TObject; Node: TTreeNode);
707begin
708 TAccessibleTreeNode.WrapControl(Node as TORTreeNode);
709end;
710
711procedure TfrmReminderTree.tvRemDeletion(Sender: TObject; Node: TTreeNode);
712begin
713 TAccessibleTreeNode.UnwrapControl(Node as TORTreeNode);
714end;
715
716procedure TfrmReminderTree.mnuExitClick(Sender: TObject);
717begin
718 Close;
719end;
720
721end.
Note: See TracBrowser for help on using the repository browser.