Module

fGraphProfiles

Path

C:\CPRS\CPRS30\fGraphProfiles.pas

Last Modified

7/15/2014 3:26:36 PM

Units Used in Interface

Name Comments
fBase508Form -
rCore -
uCore -
uGraphs -

Units Used in Implementation

Name Comments
fGraphData -
fGraphOthers -
fRptBox -
rGraphs -

Classes

Name Comments
TfrmGraphProfiles -

Procedures

Name Owner Declaration Scope Comments
AddToList TfrmGraphProfiles procedure AddToList(aItem: string; aListBox: TORListBox); Public/Published -
AllItemsAfter TfrmGraphProfiles procedure AllItemsAfter(var filetype, typedata: string); Public -
AllItemsBefore TfrmGraphProfiles procedure AllItemsBefore(var typedata: string); Public -
ArrangeList TfrmGraphProfiles procedure ArrangeList(aCheckFile, aCheckItem, aItem: string; aListBox: TORListBox; var addtolist: boolean); Public/Published -
AssignHints TfrmGraphProfiles procedure AssignHints; Public/Published -
AssignProfile TfrmGraphProfiles procedure AssignProfile(aList: TStrings; aProfile: string; UserNum: int64; allitems: boolean); Public/Published CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
AssignProfilePost TfrmGraphProfiles procedure AssignProfilePost(aList: TStrings; var aProfile, typedata: string); Public/Published -
AssignProfilePre TfrmGraphProfiles procedure AssignProfilePre(aList: TStrings; var aProfile: string; UserNum: int64); Public/Published CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
btnClearClick TfrmGraphProfiles procedure btnClearClick(Sender: TObject); Public/Published -
btnCloseClick TfrmGraphProfiles procedure btnCloseClick(Sender: TObject); Public/Published -
btnDefinitionsClick TfrmGraphProfiles procedure btnDefinitionsClick(Sender: TObject); Public/Published -
btnDeleteClick TfrmGraphProfiles procedure btnDeleteClick(Sender: TObject); Public/Published -
btnRemoveAllClick TfrmGraphProfiles procedure btnRemoveAllClick(Sender: TObject); Public/Published -
btnRemoveOneClick TfrmGraphProfiles procedure btnRemoveOneClick(Sender: TObject); Public/Published -
btnRenameClick TfrmGraphProfiles procedure btnRenameClick(Sender: TObject); Public/Published -
btnSaveClick TfrmGraphProfiles procedure btnSaveClick(Sender: TObject); Public/Published -
btnViewsClick TfrmGraphProfiles procedure btnViewsClick(Sender: TObject); Public/Published -
cboAllItemsChange TfrmGraphProfiles procedure cboAllItemsChange(Sender: TObject); Public/Published -
cboAllItemsClick TfrmGraphProfiles procedure cboAllItemsClick(Sender: TObject); Public/Published -
cboAllItemsNeedData TfrmGraphProfiles procedure cboAllItemsNeedData(Sender: TObject; const StartFrom: String; Direction, InsertAt: Integer); Public/Published -
cboUserClick TfrmGraphProfiles procedure cboUserClick(Sender: TObject); Public/Published -
cboUserNeedData TfrmGraphProfiles procedure cboUserNeedData(Sender: TObject; const StartFrom: string; Direction, InsertAt: Integer); Public/Published -
CheckPublic TfrmGraphProfiles procedure CheckPublic; Public/Published -
CheckToClear TfrmGraphProfiles procedure CheckToClear; Private -
ComboBoxSetup TfrmGraphProfiles procedure ComboBoxSetup(Sender: TObject); Public -
DialogGraphProfiles - procedure DialogGraphProfiles(var actionOK: boolean; var checkaction: boolean; aGraphSetting: TGraphSetting; var aProfname, aProfilestring, aSection: string; const PatientDFN: string; var aCounter: integer; apply: boolean; aSelections: string); Interfaced -
DialogOptionsGraphProfiles - procedure DialogOptionsGraphProfiles(var actiontype: boolean); Interfaced Create the form and make it modal, return an action
FillSource TfrmGraphProfiles procedure FillSource(aList: TORListBox); Public/Published CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
FormClose TfrmGraphProfiles procedure FormClose(Sender: TObject; var Action: TCloseAction); Public/Published -
FormCreate TfrmGraphProfiles procedure FormCreate(Sender: TObject); Public/Published -
FormShow TfrmGraphProfiles procedure FormShow(Sender: TObject); Public/Published -
IDProfile TfrmGraphProfiles procedure IDProfile(var profilename, proftype: string); Public -
ListBoxSetup TfrmGraphProfiles procedure ListBoxSetup(Sender: TObject); Public -
lstItemsDisplayedChange TfrmGraphProfiles procedure lstItemsDisplayedChange(Sender: TObject); Public/Published -
lstItemsDisplayedDblClick TfrmGraphProfiles procedure lstItemsDisplayedDblClick(Sender: TObject); Public/Published -
lstOtherSourcesChange TfrmGraphProfiles procedure lstOtherSourcesChange(Sender: TObject); Public/Published CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
lstOtherSourcesEnter TfrmGraphProfiles procedure lstOtherSourcesEnter(Sender: TObject); Public/Published -
lstOtherSourcesExit TfrmGraphProfiles procedure lstOtherSourcesExit(Sender: TObject); Public/Published -
lstSourcesChange TfrmGraphProfiles procedure lstSourcesChange(Sender: TObject); Public/Published CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
lstSourcesDblClick TfrmGraphProfiles procedure lstSourcesDblClick(Sender: TObject); Public/Published -
lstSourcesEnter TfrmGraphProfiles procedure lstSourcesEnter(Sender: TObject); Public/Published -
lstSourcesExit TfrmGraphProfiles procedure lstSourcesExit(Sender: TObject); Public/Published -
QualifierDelete TfrmGraphProfiles procedure QualifierDelete(line: string); Private -
radSourceAllClick TfrmGraphProfiles procedure radSourceAllClick(Sender: TObject); Public/Published -
Report TfrmGraphProfiles procedure Report(aListBox: TORListBox); Public -
wmNCLButtonDown TfrmGraphProfiles procedure wmNCLButtonDown(var Msg: TWMNCLButtonDown); message WM_NCLBUTTONDOWN; Private -

Functions

Name Owner Declaration Scope Comments
GetProfileName TfrmGraphProfiles function GetProfileName(infotitle, info: string; var newprofilename: string): boolean; Public -
ProfileExists TfrmGraphProfiles function ProfileExists(aName, aType: string): boolean; Public/Published -

Global Variables

Name Type Declaration Comments
frmGraphProfiles TfrmGraphProfiles frmGraphProfiles: TfrmGraphProfiles; -


Module Source

1     unit fGraphProfiles;
2     
3     interface
4     
5     uses
6       Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7       ComCtrls, StdCtrls, ExtCtrls, CheckLst, ORCtrls, ORFn, uGraphs, rCore, uCore,
8       fBase508Form, VA508AccessibilityManager;
9     
10    type
11      TfrmGraphProfiles = class(TfrmBase508Form)
12        btnAdd: TButton;
13        btnAddAll: TButton;
14        btnClear: TButton;
15        btnClose: TButton;
16        btnDelete: TButton;
17        btnRemoveAll: TButton;
18        btnRemoveOne: TButton;
19        btnRename: TButton;
20        btnSave: TButton;
21        btnSavePublic: TButton;
22        bvlBase: TBevel;
23        cboAllItems: TORComboBox;
24        lblApply: TLabel;
25        lblDisplay: TLabel;
26        lblEditInfo: TLabel;
27        lblEditInfo1: TLabel;
28        lblSelectandDefine: TLabel;
29        lblSelection: TLabel;
30        lblSelectionInfo: TLabel;
31        lstActualItems: TORListBox;
32        lstDrugClass: TListBox;
33        lstItemsDisplayed: TORListBox;
34        lstItemsSelection: TORListBox;
35        lstScratch: TListBox;
36        lstTests: TListBox;
37        pnlApply: TPanel;
38        pnlSource: TPanel;
39        pnlTempData: TPanel;
40        radSourceAll: TRadioButton;
41        radSourcePat: TRadioButton;
42        radTop: TRadioButton;
43        radBottom: TRadioButton;
44        radBoth: TRadioButton;
45        radNeither: TRadioButton;
46        lblSave: TLabel;
47        lblClose: TLabel;
48        lblUser: TLabel;
49        pnlAllSources: TPanel;
50        pnlSources: TPanel;
51        lblSource: TLabel;
52        lstSources: TORListBox;
53        pnlOtherSources: TPanel;
54        pnlOtherSourcesUser: TPanel;
55        lblOtherPersons: TLabel;
56        cboUser: TORComboBox;
57        pnlOtherSourcesBottom: TPanel;
58        lstOtherSources: TORListBox;
59        btnViews: TButton;
60        btnDefinitions: TButton;
61        pnlOtherViews: TPanel;
62        lblOtherViews: TLabel;
63        lblSelectOthers: TLabel;
64        splViews: TSplitter;
65        procedure FormCreate(Sender: TObject);
66        procedure FormShow(Sender: TObject);
67        procedure FormClose(Sender: TObject; var Action: TCloseAction);
68    
69        procedure btnClearClick(Sender: TObject);
70        procedure btnCloseClick(Sender: TObject);
71        procedure btnDefinitionsClick(Sender: TObject);
72        procedure btnRemoveAllClick(Sender: TObject);
73        procedure btnRemoveOneClick(Sender: TObject);
74        procedure btnViewsClick(Sender: TObject);
75        procedure cboAllItemsClick(Sender: TObject);
76        procedure cboAllItemsChange(Sender: TObject);
77        procedure cboAllItemsNeedData(Sender: TObject; const StartFrom: String;
78          Direction, InsertAt: Integer);
79        procedure cboUserClick(Sender: TObject);
80        procedure cboUserNeedData(Sender: TObject; const StartFrom: string;
81          Direction, InsertAt: Integer);
82        procedure lstItemsDisplayedChange(Sender: TObject);
83        procedure lstItemsDisplayedDblClick(Sender: TObject);
84        procedure lstSourcesChange(Sender: TObject);
85        procedure lstSourcesDblClick(Sender: TObject);
86        procedure lstSourcesEnter(Sender: TObject);
87        procedure lstSourcesExit(Sender: TObject);
88        procedure lstOtherSourcesEnter(Sender: TObject);
89        procedure lstOtherSourcesExit(Sender: TObject);
90        procedure radSourceAllClick(Sender: TObject);
91    
92        procedure btnDeleteClick(Sender: TObject);
93        procedure btnRenameClick(Sender: TObject);
94        procedure btnSaveClick(Sender: TObject);
95    
96        procedure AddToList(aItem: string; aListBox: TORListBox);
97        procedure ArrangeList(aCheckFile, aCheckItem, aItem: string;
98          aListBox: TORListBox; var addtolist: boolean);
99        procedure AssignHints;
100       procedure AssignProfile(aList: TStrings; aProfile: string; UserNum: int64; allitems: boolean);
101       procedure AssignProfilePre(aList: TStrings; var aProfile: string; UserNum: int64);
102       procedure AssignProfilePost(aList: TStrings; var aProfile, typedata: string);
103       procedure CheckPublic;
104       procedure FillSource(aList: TORListBox);
105       function ProfileExists(aName, aType: string): boolean;
106       procedure lstOtherSourcesChange(Sender: TObject);
107     private
108       FHintPauseTime: integer;
109       FPublicEditor: boolean;
110       procedure CheckToClear;
111       procedure QualifierDelete(line: string);
112       procedure wmNCLButtonDown(var Msg: TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
113     public
114       procedure AllItemsAfter(var filetype, typedata: string);
115       procedure AllItemsBefore(var typedata: string);
116       procedure IDProfile(var profilename, proftype: string);
117       procedure ListBoxSetup(Sender: TObject);
118       procedure ComboBoxSetup(Sender: TObject);
119       procedure Report(aListBox: TORListBox);
120       function GetProfileName(infotitle, info: string; var newprofilename: string): boolean;
121     end;
122   
123   var
124     frmGraphProfiles: TfrmGraphProfiles;
125   
126   procedure DialogOptionsGraphProfiles(var actiontype: boolean);
127   procedure DialogGraphProfiles(var actionOK: boolean;
128     var checkaction: boolean; aGraphSetting: TGraphSetting;
129     var aProfname, aProfilestring, aSection: string;
130     const PatientDFN: string; var aCounter: integer;
131     apply: boolean; aSelections: string);
132   
133   implementation
134   
135   {$R *.DFM}
136   
137   uses
138     rGraphs, fGraphData, fGraphOthers, fRptBox, VAUtils;
139   
140   procedure DialogOptionsGraphProfiles(var actiontype: boolean);
141   // create the form and make it modal, return an action
142   var
143     FGraphSetting: TGraphSetting;
144     settings: string;
145     actionOK, checkaction: boolean;
146     counter: integer;
147     aSelections, profile, profilestring, section: string;
148   begin
149     if (GtslData = nil) then
150     begin
151       ShowMsg(TXT_NOGRAPHING);
152       exit;
153     end;
154     settings := GetCurrentSetting;
155     FGraphSetting := GraphSettingsInit(settings);
156     checkaction := false;
157     actionOK := false;
158     profile := '*';
159     counter := BIG_NUMBER;
160     aSelections :='';
161     DialogGraphProfiles(actionOK, checkaction, FGraphSetting,
162       profile, profilestring, section, Patient.DFN, counter, false, aSelections);
163     FGraphSetting.Free;
164   end;
165   
166   procedure DialogGraphProfiles(var actionOK: boolean;
167     var checkaction: boolean; aGraphSetting: TGraphSetting;
168     var aProfname, aProfilestring, aSection: string;
169     const PatientDFN: string; var aCounter: integer;
170     apply: boolean; aSelections: string);
171   var
172     i: integer;
173     astring, counter, profile, profileitem, profiletype, profiletext: string;
174     frmGraphProfiles: TfrmGraphProfiles;
175   begin
176     frmGraphProfiles := TfrmGraphProfiles.Create(Application);
177     try
178       with frmGraphProfiles do
179       begin
180         lblSave.Hint := aProfname;
181         lblClose.Hint := PatientDFN;
182         if apply then
183         begin
184           pnlApply.Visible := true;
185           frmGraphProfiles.Caption := 'Select Items and Define Views';
186         end
187         else
188         begin
189           pnlApply.Visible := false;
190           frmGraphProfiles.Caption := 'Define Views';
191         end;
192         if length(aSelections) > 0 then
193         begin
194           if GtslViews.Count = 0 then
195             GtslViews.Insert(0, VIEW_CURRENT + '^<current selections>^' + aSelections)
196           else if Piece(GtslViews[0], '^', 1) <> VIEW_CURRENT then
197             GtslViews.Insert(0, VIEW_CURRENT + '^<current selections>^' + aSelections)
198           else
199             GtslViews[0] := VIEW_CURRENT + '^<current selections>^' + aSelections;
200         end;
201         ResizeAnchoredFormToFont(frmGraphProfiles);
202         ShowModal;
203         actionOK := (btnClose.Tag = 1);
204         profiletext := '';
205         aProfname := '';
206         if actionOK then
207         begin
208           aProfname := lblSave.Hint;
209           if radTop.Checked then aSection := 'top'
210           else if radBottom.Checked then aSection := 'bottom'
211           else if radBoth.Checked then aSection := 'both'
212           else aSection := 'neither';
213           profile := '';
214           with lstItemsDisplayed do
215           for i := 0 to Items.Count - 1 do
216           begin
217             astring := Items[i];
218             profiletext := profiletext + Piece(astring, '^', 3) + '^';
219             profiletype := Piece(astring, '^', 1);
220             if profiletype = '8925' then
221               profileitem := UpperCase(Piece(astring, '^', 3))
222             else
223               profileitem := Piece(astring, '^', 2);
224             profile := profile + profiletype + '~' + profileitem + '~|';
225           end;
226           if (GtslViews.Count > 0) and (Piece(GtslViews[0], '^', 1) = VIEW_CURRENT) then
227             counter := inttostr(GtslViews.Count)
228           else
229             counter := inttostr(GtslViews.Count + 1);
230           aProfileString := '<view' + counter + '>^' + profile + '^' + profiletext;
231           GtslViews.Add(aProfileString);
232           aCounter := strtointdef(counter, BIG_NUMBER);
233           with aGraphSetting do
234           begin
235             lstActualItems.Items.Clear;
236             with lstItemsDisplayed do
237             for i := 0 to Items.Count - 1 do
238             begin
239               lstActualItems.Items.Add(Piece(Items[i], '<', 1));  //get rid of <any>
240             end;
241             ItemsForDisplay := lstActualItems.Items;
242           end;
243         end;
244       end;
245     finally
246       frmGraphProfiles.Release;
247     end;
248   end;
249   
250   procedure TfrmGraphProfiles.FormCreate(Sender: TObject);
251   begin
252     FPublicEditor := GraphPublicEditor;
253   end;
254   
255   procedure TfrmGraphProfiles.FormShow(Sender: TObject);
256   begin
257     if GtslData = nil then
258     begin
259       radSourceAll.Checked := true;
260       radSourcePat.Enabled := false;
261     end
262     else if GtslData.Count < 1 then
263     begin
264       radSourceAll.Checked := true;
265       radSourcePat.Enabled := false;
266     end;
267     cboAllItems.Visible := radSourceAll.Checked;
268     FillSource(lstSources);
269     cboUser.InitLongList('');
270     FHintPauseTime := Application.HintHidePause;
271     Application.HintHidePause := 9000; // uses a longer hint pause time
272   end;
273   
274   procedure TfrmGraphProfiles.FormClose(Sender: TObject; var Action: TCloseAction);
275   begin
276     Application.HintHidePause := FHintPauseTime;
277   end;
278   
279   procedure TfrmGraphProfiles.radSourceAllClick(Sender: TObject);
280   var
281     dfn: string;
282   begin
283     if Sender = radSourceAll then
284     begin
285       lstItemsSelection.Visible := false;
286       cboAllItems.Visible := true;
287     end
288     else
289     begin
290       if radSourcePat.Tag = 0 then
291       begin
292         dfn := lblClose.Hint;
293         FastAssign(rpcGetAllItems(dfn), lstTests.Items);  // items for patient
294         FastAssign(rpcGetItems('50.605', dfn), lstDrugClass.Items);
295         radSourcePat.Tag := 1;
296       end;
297       cboAllItems.Visible := false;
298       lstItemsSelection.Visible := true;
299     end;
300     if lstSources.ItemIndex > 0 then
301     begin
302       lstSources.Tag := BIG_NUMBER;
303       lstSourcesChange(lstSources);
304     end
305     else if lstSources.ItemIndex > 0 then
306     begin
307       lstOtherSources.Tag := BIG_NUMBER;
308       lstOtherSourcesChange(lstOtherSources);
309     end;
310   end;
311   
312   procedure TfrmGraphProfiles.lstSourcesChange(Sender: TObject);
313   var
314   // CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
315     UserNum: int64;
316     filetype, typedata: string;
317     aListBox: TORListBox;
318   begin
319     CheckPublic;
320     aListBox := (Sender as TORListBox);
321     if aListBox = lstOtherSources then
322       exit;
323     if lstSources.Tag <> BIG_NUMBER then
324       exit;
325     UserNum := User.DUZ;
326     lstOtherSources.ItemIndex := -1;
327     cboAllItems.Items.Clear;
328     cboAllItems.Text := '';
329     if aListBox.ItemIndex = -1 then exit;
330     typedata :=  aListBox.Items[aListBox.ItemIndex];
331     if pos(LLS_FRONT, typedata) > 0 then  // <clear all selections>
332     begin
333       lstItemsSelection.Clear;
334       cboAllItems.Items.Clear;
335       cboAllItems.Text := '';
336       exit;
337     end;
338     filetype := Piece(typedata, '^', 1);
339     if (filetype = VIEW_PERSONAL)
340     or (filetype = VIEW_PUBLIC)
341     or (filetype = VIEW_LABS)
342     or (filetype = VIEW_TEMPORARY)
343     or (filetype = VIEW_CURRENT) then
344     begin
345       AssignProfile(cboAllItems.Items, typedata, UserNum, false);
346       FastAssign(cboAllItems.Items, lstItemsSelection.Items);
347     end
348     else
349     begin
350       AllItemsBefore(typedata);
351       AllItemsAfter(filetype, typedata);
352     end;
353     cboAllItemsChange(cboAllItems);
354   end;
355   
356   procedure TfrmGraphProfiles.lstSourcesDblClick(Sender: TObject);
357   begin
358     if cboAllItems.Visible then
359     begin
360       if cboAllItems.Items.Count < 1 then exit;
361       cboAllItems.ItemIndex := 0;
362       cboAllItemsClick(cboAllItems);
363     end
364     else
365     begin
366       if lstItemsSelection.Items.Count < 1 then exit;
367       lstItemsSelection.Selected[0] := true;
368       cboAllItemsClick(lstItemsSelection);
369     end;
370   end;
371   
372   procedure TfrmGraphProfiles.lstSourcesEnter(Sender: TObject);
373   begin
374     lstSources.Tag := BIG_NUMBER;
375   end;
376   
377   procedure TfrmGraphProfiles.lstSourcesExit(Sender: TObject);
378   begin
379     lstSources.Tag := 0;
380   end;
381   
382   procedure TfrmGraphProfiles.lstOtherSourcesChange(Sender: TObject);
383   var
384   // CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
385     UserNum: int64;
386     filetype, typedata: string;
387     aListBox: TORListBox;
388   begin
389     CheckPublic;
390     aListBox := (Sender as TORListBox);
391     if aListBox = lstSources then
392       exit;
393     if lstOtherSources.Tag <> BIG_NUMBER then
394       exit;
395     UserNum := cboUser.ItemID;
396     lstSources.ItemIndex := -1;
397     cboAllItems.Items.Clear;
398     cboAllItems.Text := '';
399     if aListBox.ItemIndex = -1 then exit;
400     typedata :=  aListBox.Items[aListBox.ItemIndex];
401     if pos(LLS_FRONT, typedata) > 0 then  // <clear all selections>
402     begin
403       lstItemsSelection.Clear;
404       cboAllItems.Items.Clear;
405       cboAllItems.Text := '';
406       exit;
407     end;
408     filetype := Piece(typedata, '^', 1);
409     if (filetype = VIEW_PERSONAL)
410     or (filetype = VIEW_PUBLIC)
411     or (filetype = VIEW_LABS) then
412     begin
413       AssignProfile(cboAllItems.Items, typedata, UserNum, false);
414       FastAssign(cboAllItems.Items, lstItemsSelection.Items);
415     end
416     else
417     begin
418       AllItemsBefore(typedata);
419       AllItemsAfter(filetype, typedata);
420     end;
421     cboAllItemsChange(cboAllItems);
422   end;
423   
424   procedure TfrmGraphProfiles.lstOtherSourcesEnter(Sender: TObject);
425   begin
426     lstOtherSources.Tag := BIG_NUMBER;
427   end;
428   
429   procedure TfrmGraphProfiles.lstOtherSourcesExit(Sender: TObject);
430   begin
431     lstOtherSources.Tag := 0;
432   end;
433   
434   procedure TfrmGraphProfiles.cboUserClick(Sender: TObject);
435   begin
436     FillSource(lstOtherSources);
437     if cboUser.ItemIndex <> -1 then
438       lblOtherViews.Caption := cboUser.DisplayText[cboUser.ItemIndex] + ' Views:'
439     else
440       lblOtherViews.Caption := 'Other Views:'
441   end;
442   
443   procedure TfrmGraphProfiles.cboUserNeedData(Sender: TObject;
444     const StartFrom: string; Direction, InsertAt: Integer);
445   begin
446     cboUser.ForDataUse(SubSetOfPersons(StartFrom, Direction));
447   end;
448   
449   procedure TfrmGraphProfiles.cboAllItemsChange(Sender: TObject);
450   var
451    astring: string;
452   begin
453    if (Sender is TORListBox) then
454      btnClear.Enabled := btnSave.Enabled or ((Sender as TORListBox).Items.Count > 0)
455    else if (Sender is TORComboBox) then
456      btnClear.Enabled := btnSave.Enabled or ((Sender as TORComboBox).Items.Count > 0);
457    if lstItemsSelection.Visible then
458    begin
459      btnAddAll.Enabled := lstItemsSelection.Items.Count > 0;
460      btnAdd.Enabled := lstItemsSelection.ItemIndex > -1;
461      if btnAdd.Enabled then
462        astring := lstItemsSelection.Items[lstItemsSelection.ItemIndex];
463    end
464    else
465    begin
466      btnAddAll.Enabled := cboAllItems.Items.Count > 0;
467      btnAdd.Enabled := cboAllItems.ItemIndex > -1;
468    end;
469   end;
470   
471   procedure TfrmGraphProfiles.cboAllItemsClick(Sender: TObject);
472   begin
473     if Sender is TButton then
474     begin
475       if lstItemsSelection.Visible then
476       begin
477         if Sender = btnAddAll then
478           lstItemsSelection.ItemIndex := 0;
479         Sender := lstItemsSelection;
480       end
481       else
482       begin
483         if Sender = btnAddAll then
484           cboAllItems.ItemIndex := 0;
485         Sender := cboAllItems;
486       end;
487     end;
488     if (Sender is TORComboBox) then
489       ComboBoxSetup(Sender)
490     else if (Sender is TORListBox) then
491       ListBoxSetup(Sender)
492     else exit;
493     lstItemsDisplayedChange(self);
494     CheckToClear;
495   end;
496   
497   procedure TfrmGraphProfiles.cboAllItemsNeedData(Sender: TObject;
498     const StartFrom: String; Direction, InsertAt: Integer);
499   var
500     filetype: string;
501   begin
502     if lstSources.ItemIndex = -1 then exit;
503     filetype := Piece(lstSources.Items[lstSources.ItemIndex], '^', 1);
504     cboAllItems.ForDataUse(rpcLookupItems(filetype, StartFrom, Direction));
505   end;
506   
507   procedure TfrmGraphProfiles.lstItemsDisplayedChange(Sender: TObject);
508   begin
509    btnSave.Enabled := lstItemsDisplayed.Items.Count > 0;
510    btnSavePublic.Enabled := btnSave.Enabled and FPublicEditor;
511    btnRemoveAll.Enabled := btnSave.Enabled;
512    btnAdd.Enabled := (cboAllItems.Visible and (cboAllItems.ItemIndex > -1))
513      or (lstItemsSelection.Visible and (lstItemsSelection.ItemIndex > -1));
514    btnRemoveOne.Enabled :=  btnSave.Enabled and (lstItemsDisplayed.ItemIndex > -1);
515    btnClear.Enabled := btnSave.Enabled or (lstItemsSelection.Items.Count > 0);
516    if btnSave.Enabled and pnlApply.Visible then btnClose.Caption := 'Close and Display'
517    else btnClose.Caption := 'Close';
518   end;
519   
520   procedure TfrmGraphProfiles.lstItemsDisplayedDblClick(Sender: TObject);
521   var
522     line: string;
523   begin
524     if lstItemsDisplayed.ItemIndex < 0 then exit;
525     line := lstItemsDisplayed.Items[lstItemsDisplayed.ItemIndex];
526     lstItemsDisplayed.Items.Delete(lstItemsDisplayed.ItemIndex);
527     QualifierDelete(line);
528     lstItemsDisplayedChange(self);
529   end;
530   
531   procedure TfrmGraphProfiles.btnRemoveOneClick(Sender: TObject);
532   begin
533     lstItemsDisplayedDblClick(self);
534     CheckToClear;
535   end;
536   
537   procedure TfrmGraphProfiles.btnRemoveAllClick(Sender: TObject);
538   begin
539     lstItemsDisplayed.Clear;
540     lstItemsDisplayedChange(self);
541     CheckToClear;
542   end;
543   
544   procedure TfrmGraphProfiles.btnDefinitionsClick(Sender: TObject);
545   var
546     firstpublic, firstpersonal, firstlabs: boolean;
547     i, j: integer;
548     aLine, aProfile, filetype, aString, front, back, piece2: string;
549     aList, templist: TStringList;
550   begin
551     front := Piece(LLS_FRONT, '^', 2);
552     back := Piece(LLS_BACK, '^', 1);
553     templist := TStringList.Create;
554     aList := TStringList.Create;
555     lstScratch.Clear;
556     lstScratch.Sorted := false;
557     firstpublic := true;
558     firstpersonal := true;
559     firstlabs := true;
560     for i := 0 to lstSources.Items.Count - 1 do
561     begin
562       aLine :=  lstSources.Items[i];
563       filetype := Piece(aLine, '^', 1);
564       aProfile := Piece(aLine, '^', 2);
565       if (filetype = VIEW_PERSONAL)
566       or (filetype = VIEW_PUBLIC)
567       or (filetype = VIEW_LABS) then
568       begin
569         if (filetype = VIEW_PUBLIC) and firstpublic then
570         begin
571           templist.Add(' ');
572           templist.Add(front + copy('Public Views' + back, 0, 60));
573           firstpublic := false;
574         end
575         else
576         if (filetype = VIEW_PERSONAL) and firstpersonal then
577         begin
578           templist.Add(' ');
579           templist.Add(front + copy('Personal Views' + back, 0, 60));
580           firstpersonal := false;
581         end
582         else
583         if (filetype = VIEW_LABS) and firstlabs then
584         begin
585           templist.Add(' ');
586           templist.Add(front + copy('Lab Groups' + back, 0, 60));
587           firstlabs := false;
588         end;
589         AssignProfile(aList, aLine, User.DUZ, true);
590         templist.Add(aProfile);
591         for j := 0 to aList.Count - 1 do
592         begin
593           aLine := aList[j];
594           piece2 := Piece(aLine, '^', 2);
595           if strtointdef(copy(piece2, 0, 1), -1) > 0 then
596           begin
597             aString := Piece(aLine, '^', 3);
598             if copy(aString, 0, 1) = '_' then
599               aString := copy(aString, 2, length(aString));
600             templist.Add('   ' + aString);
601           end
602           else
603           begin
604   
605           end;
606         end;
607       end;
608     end;
609     if cboUser.ItemIndex > -1 then
610     begin
611       firstpersonal := true;
612       firstlabs := true;
613       templist.Add('');
614       templist.Add('');
615       templist.Add('Views and Lab Groups for ' + cboUser.Text);
616       for i := 0 to lstOtherSources.Items.Count - 1 do
617       begin
618         aLine :=  lstOtherSources.Items[i];
619         filetype := Piece(aLine, '^', 1);
620         aProfile := Piece(aLine, '^', 2);
621         if (filetype = VIEW_PERSONAL)
622         or (filetype = VIEW_LABS) then
623         begin
624           if (filetype = VIEW_PERSONAL) and firstpersonal then
625           begin
626             templist.Add(' ');
627             templist.Add(front + copy('Views' + back, 0, 60));
628             firstpersonal := false;
629           end
630           else
631           if (filetype = VIEW_LABS) and firstlabs then
632           begin
633             templist.Add(' ');
634             templist.Add(front + copy('Lab Groups' + back, 0, 60));
635             firstlabs := false;
636           end;
637           AssignProfile(aList, aLine, cboUser.ItemID, true);
638           templist.Add(aProfile);
639           for j := 0 to aList.Count - 1 do
640           begin
641             aLine := aList[j];
642             piece2 := Piece(aLine, '^', 2);
643             if strtointdef(copy(piece2, 0, 1), -1) > 0 then
644             begin
645               aString := Piece(aLine, '^', 3);
646               if copy(aString, 0, 1) = '_' then
647                 aString := copy(aString, 2, length(aString));
648               templist.Add('   ' + aString);
649             end;
650           end;
651         end;
652       end;
653     end;
654     templist.Insert(0, 'Definitions of Views and Lab Groups');
655     templist.Insert(1, '');
656     templist.Insert(2,'Your Personal Views, Public Views, and Lab Groups');
657     ReportBox(templist, 'Views and Lab Groups', true);
658     templist.Free;
659     aList.Free;
660   end;
661   
662   procedure TfrmGraphProfiles.btnClearClick(Sender: TObject);
663   begin
664     lstItemsDisplayed.Items.Clear;
665     lstItemsSelection.Items.Clear;
666     cboAllItems.Items.Clear;
667     cboAllItems.Text :='';
668     lstItemsDisplayedChange(self);
669     cboAllItemsChange(self);
670     lstSources.ItemIndex := -1;
671     lstOtherSources.ItemIndex := -1;
672   end;
673   
674   procedure TfrmGraphProfiles.btnDeleteClick(Sender: TObject);
675   var
676     publicview: boolean;
677     info, profilename, profname, proftype: string;
678   begin
679     if lstSources.ItemIndex < 0 then
680     begin
681       ShowMsg('You must select a valid View for deletion.');
682       exit;
683     end;
684     publicview := false;
685     profilename := '';
686     info := lstSources.Items[lstSources.ItemIndex];
687     proftype := Piece(info, '^', 1);
688     profname := Piece(info, '^', 2);
689     if proftype = VIEW_PERSONAL then
690       profilename := profname
691     else if (proftype = VIEW_PUBLIC) and FPublicEditor then
692     begin
693       profilename := profname;
694       publicview := true;
695     end
696     else
697     begin
698       ShowMsg('You must select a valid View for deletion.');
699       exit;
700     end;
701     if publicview then
702     begin
703       if MessageDlg('This is Public and may be used by others.'
704         + #13 + 'Delete ' + profilename + '?', mtConfirmation,
705         [mbYes, mbNo], 0) = mrYes then
706       begin
707         rpcDeleteGraphProfile(UpperCase(profilename), '1');
708         btnClose.Tag := 1;
709         MessageDlg('The public view, ' + profilename + ' has been deleted.',
710         mtInformation, [mbOk], 0);
711       end
712       else exit;
713     end
714     else
715     begin
716       if MessageDlg('Delete ' + profilename + '?', mtConfirmation,
717         [mbYes, mbNo], 0) = mrYes then
718       begin
719         rpcDeleteGraphProfile(UpperCase(profilename), '0');
720         btnClose.Tag := 1;
721         MessageDlg('Your personal view, ' + profilename + ' has been deleted.',
722         mtInformation, [mbOk], 0);
723       end
724       else exit;
725     end;
726     btnClearClick(self);
727     lstItemsDisplayed.Items.Clear;
728     lstItemsSelection.Items.Clear;
729     cboAllItems.Items.Clear;
730     cboAllItems.Text :='';
731     GraphDataOnUser;
732     FormShow(self);
733     lstItemsDisplayedChange(self);
734     btnDelete.Enabled := false;
735     btnRename.Enabled := false;
736     if lstSources.Count > 0 then
737       lstSources.ItemIndex := 0;
738   end;
739   
740   procedure TfrmGraphProfiles.btnRenameClick(Sender: TObject);
741   var
742     profentered, publicview: boolean;
743     i, j: integer;
744     astring, info, infotitle, newprofilename, profile, profileitem, profilename, profiletype, profname, proftype: string;
745     aList: TStrings;
746   begin
747     if lstSources.ItemIndex < 0 then
748     begin
749       ShowMsg('You must select a valid View to rename.');
750       exit;
751     end;
752     publicview := false;
753     profilename := '';
754     info := lstSources.Items[lstSources.ItemIndex];
755     proftype := Piece(info, '^', 1);
756     profname := Piece(info, '^', 2);
757     if proftype = VIEW_PERSONAL then
758       profilename := profname
759     else if (proftype = VIEW_PUBLIC) and FPublicEditor then
760     begin
761       profilename := profname;
762       publicview := true;
763     end
764     else
765     begin
766       ShowMsg('You must select a valid View to rename.');
767     end;
768     btnRemoveAllClick(self);
769     lstSourcesDblClick(self);
770     if publicview then
771     begin
772       infotitle := 'Rename this Public View';
773       info := 'This is Public and may be used by others.'
774         + #13 + 'Enter a new name for ' + profilename + '.'
775     end
776     else
777     begin
778       infotitle := 'Rename your Personal View';
779       info := 'Enter a new name for ' + profilename + '.'
780     end;
781     profentered := GetProfileName(infotitle, info, newprofilename);
782     if not profentered then exit;
783     info := '';
784     if not ProfileExists(newprofilename, VIEW_PUBLIC) and publicview then
785       info := 'The Public View, ' + profilename + ', will be changed to '
786         + newprofilename + #13 + 'Is this OK?'
787     else if not ProfileExists(newprofilename, VIEW_PERSONAL) then
788       info := 'Your Personal View, ' + profilename + ', will be changed to '
789         + newprofilename + #13 + 'Is this OK?';
790     if length(info) > 0 then
791       if MessageDlg(info, mtConfirmation, [mbYes, mbNo], 0) <> mrYes then exit;
792     aList := TStringList.Create;
793     profile := '';
794     aList.Clear;
795     j := 1;
796     with lstItemsDisplayed do
797     for i := 0 to Items.Count - 1 do
798     begin
799       astring := Items[i];
800       profiletype := Piece(astring, '^', 1);
801       if profiletype = '8925' then
802         profileitem := UpperCase(Piece(astring, '^', 3))
803       else
804         profileitem := Piece(astring, '^', 2);
805       profile := profile + profiletype + '~' + profileitem + '~|';
806       j := j + 1;
807       if (j mod 10) = 0 then
808         if length(profile) > 0 then
809         begin
810           aList.Add(UpperCase(profile));
811           profile := '';
812         end;
813     end;
814     if length(profile) > 0 then
815     begin
816       aList.Add(UpperCase(profile));
817       profile := '';
818     end;
819     if publicview then
820     begin
821       proftype := VIEW_PUBLIC;
822       rpcDeleteGraphProfile(UpperCase(profilename), '1');
823       rpcSetGraphProfile(newprofilename, '1', aList);
824       btnClose.Tag := 1;
825     end
826     else
827     begin
828       proftype := VIEW_PERSONAL;
829       rpcDeleteGraphProfile(UpperCase(profilename), '0');
830       rpcSetGraphProfile(newprofilename, '0', aList);
831       btnClose.Tag := 1;
832     end;
833     aList.Free;
834     IDProfile(newprofilename, proftype);
835   end;
836   
837   procedure TfrmGraphProfiles.btnSaveClick(Sender: TObject);
838   var
839     profentered, puplicedit: boolean;
840     i, j: integer;
841     astring, info, infotitle, profile, profileitem, profilename, profiletype, profname, proftype: string;
842     aList: TStrings;
843   begin
844     puplicedit := Sender = btnSavePublic;
845     if lstItemsDisplayed.Items.Count < 1 then exit;
846     profilename := '';
847     if lstSources.ItemIndex > -1 then
848     begin
849       info := lstSources.Items[lstSources.ItemIndex];
850       if pos(LLS_FRONT, info) < 1 then
851       begin
852         proftype := Piece(info, '^', 1);
853         profname := Piece(info, '^', 2);
854         profilename := profname;
855       end;
856     end;
857     if puplicedit then
858     begin
859       infotitle := 'Save this Public View';
860       info := 'Save this Public View by entering a name for it.'
861         + #13 + 'If you are editing a View, enter the View''s name to overwrite it.';
862     end
863     else
864     begin
865       infotitle := 'Save your Personal View';
866       info := 'Save your Personal View by entering a name for it.'
867         + #13 + 'If you are editing a View, enter the View''s name to overwrite it.';
868     end;
869     profentered := GetProfileName(infotitle, info, profilename);
870     if not profentered then exit;
871     info := '';
872     if ProfileExists(profilename, VIEW_PUBLIC) and FPublicEditor and puplicedit then
873       info := 'The Public View, ' + profilename + ', will be overwritten.'
874         + #13 + 'Is this OK?'
875     else if ProfileExists(profilename, VIEW_PERSONAL) and (not puplicedit) then
876       info := 'Your Personal View, ' + profilename + ', will be overwritten.'
877         + #13 + 'Is this OK?';
878     if length(info) > 0 then
879       if MessageDlg(info, mtConfirmation, [mbYes, mbNo], 0) <> mrYes then exit;
880     aList := TStringList.Create;
881     profile := '';
882     aList.Clear;
883     j := 1;
884     with lstItemsDisplayed do
885     for i := 0 to Items.Count - 1 do
886     begin
887       astring := Items[i];
888       profiletype := Piece(astring, '^', 1);
889       if profiletype = '8925' then
890         profileitem := UpperCase(Piece(astring, '^', 3))
891       else
892         profileitem := Piece(astring, '^', 2);
893       profile := profile + profiletype + '~' + profileitem + '~|';
894       j := j + 1;
895       if (j mod 10) = 0 then
896         if length(profile) > 0 then
897         begin
898           aList.Add(UpperCase(profile));
899           profile := '';
900         end;
901     end;
902     if length(profile) > 0 then
903     begin
904       aList.Add(UpperCase(profile));
905       profile := '';
906     end;
907     if puplicedit then
908     begin
909       proftype := VIEW_PUBLIC;
910       rpcSetGraphProfile(profilename, '1', aList);
911       btnClose.Tag := 1;
912     end
913     else
914     begin
915       proftype := VIEW_PERSONAL;
916       rpcSetGraphProfile(profilename, '0', aList);
917       btnClose.Tag := 1;
918     end;
919     aList.Free;
920     IDProfile(profilename, proftype);
921   end;
922   
923   procedure TfrmGraphProfiles.btnCloseClick(Sender: TObject);
924   begin
925     if lstItemsDisplayed.Items.Count > 0 then
926       btnClose.Tag := 1;
927     Close;
928   end;
929   
930   procedure TfrmGraphProfiles.btnViewsClick(Sender: TObject);
931   begin             // not used
932     pnlOtherSources.Visible := not pnlOtherSources.Visible;
933     if pnlOtherSources.Visible then
934       btnViews.Caption := 'Hide other views'
935     else
936       btnViews.Caption := 'Show other views';
937     DialogGraphOthers(1);
938   end;
939   
940   procedure TfrmGraphProfiles.CheckPublic;
941   var
942     typedata: string;
943   begin
944     if lstSources.ItemIndex = -1 then
945     begin
946       btnDelete.Enabled := false;
947       btnRename.Enabled := false;
948       exit;
949     end;
950     typedata :=  lstSources.Items[lstSources.ItemIndex];
951     btnDelete.Enabled := (Piece(typedata, '^', 1) = VIEW_PERSONAL)
952                       or ((Piece(typedata, '^', 1) = VIEW_PUBLIC) and FPublicEditor);
953     btnRename.Enabled := btnDelete.Enabled;
954   end;
955   
956   procedure TfrmGraphProfiles.ListBoxSetup(Sender: TObject);
957   var
958     profileselected: boolean;
959     i: integer;
960     selection, first, profileitem: string;
961   begin
962     with (Sender as TORListBox) do
963     begin
964       if ItemIndex < 0 then exit;
965       selection := Items[ItemIndex];
966       if length(Piece(selection, '_', 2)) > 0 then
967         selection := Piece(selection, '_', 1) + ' ' + Piece(selection, '_', 2);
968       first := Piece(selection, '^', 1);
969       if first = '' then exit;     // line
970       profileselected := strtointdef(Piece(selection, '^', 2), 0) < 0;
971       if profileselected then
972       begin
973         for i := 2 to Items.Count - 1 do
974         begin
975           profileitem := Items[i];
976           if length(Piece(profileitem, '_', 2)) > 0 then
977             profileitem := Piece(profileitem, '_', 1) + ' ' + Piece(profileitem, '_', 2);   //*****???? ^
978           AddToList(profileitem, lstItemsDisplayed);
979         end;
980       end
981       else
982         AddToList(selection, lstItemsDisplayed);
983       if ItemIndex = 0 then Clear;        //profile or type <any>
984       ItemIndex := -1;
985     end;
986   end;
987   
988   procedure TfrmGraphProfiles.ComboBoxSetup(Sender: TObject);
989   var
990     profileselected: boolean;
991     i: integer;
992     selection, first, profileitem, subtype: string;
993   begin
994     with (Sender as TORComboBox) do
995     begin
996       if ItemIndex < 0 then exit;
997       selection := Items[ItemIndex];
998       subtype := Piece(Items[0], '^', 3);
999       subtype := Piece(subtype, ':', 2);
1000      subtype := copy(subtype, 2, length(subtype));
1001      subtype := Piece(subtype, ' ', 1);
1002      if UpperCase(copy(selection, 1, 5)) = '63AP;' then
1003          selection := copy(selection, 1, 4) + '^A;' + copy(selection, 6, 1) + ';'
1004          + Piece(selection, '^', 2) + '^' + subtype + ': ' + Piece(selection, '^', 3)
1005      else if UpperCase(copy(selection, 1, 5)) = '63MI;' then
1006          selection := copy(selection, 1, 4) + '^M;' + copy(selection, 6, 1) + ';'
1007          + Piece(selection, '^', 2) + '^' + subtype + ': ' + Piece(selection, '^', 3);
1008      if length(Piece(selection, '_', 2)) > 0 then
1009        selection := Piece(selection, '_', 1) + ' ' + Piece(selection, '_', 2);
1010      first := Piece(selection, '^', 1);
1011      if first = '' then exit;     // line
1012      profileselected := strtointdef(Piece(selection, '^', 2), 0) < 0;
1013      if profileselected then
1014      begin
1015        for i := 2 to Items.Count - 1 do
1016        begin
1017          profileitem := Items[i];
1018          if length(Piece(profileitem, '_', 2)) > 0 then
1019            profileitem := Piece(profileitem, '_', 1) + ' ' + Piece(profileitem, '_', 2);   //*****???? ^
1020          AddToList(profileitem, lstItemsDisplayed);
1021        end;
1022      end
1023      else
1024        AddToList(selection, lstItemsDisplayed);
1025      if ItemIndex = 0 then Clear;        //profile or type <any>
1026      ItemIndex := -1;
1027    end;
1028  end;
1029  
1030  procedure TfrmGraphProfiles.Report(aListBox: TORListBox);
1031  var
1032    profileselected: boolean;
1033    i: integer;
1034    selection, first, profileitem, subtype: string;
1035  begin
1036    with aListBox do
1037    begin
1038      if ItemIndex < 0 then exit;
1039      selection := Items[ItemIndex];
1040      subtype := Piece(Items[0], '^', 3);
1041      subtype := Piece(subtype, ':', 2);
1042      subtype := copy(subtype, 2, length(subtype));
1043      subtype := Piece(subtype, ' ', 1);
1044      if UpperCase(copy(selection, 1, 5)) = '63AP;' then
1045          selection := copy(selection, 1, 4) + '^A;' + copy(selection, 6, 1) + ';'
1046          + Piece(selection, '^', 2) + '^' + subtype + ': ' + Piece(selection, '^', 3)
1047      else if UpperCase(copy(selection, 1, 5)) = '63MI;' then
1048          selection := copy(selection, 1, 4) + '^M;' + copy(selection, 6, 1) + ';'
1049          + Piece(selection, '^', 2) + '^' + subtype + ': ' + Piece(selection, '^', 3);
1050      if length(Piece(selection, '_', 2)) > 0 then
1051        selection := Piece(selection, '_', 1) + ' ' + Piece(selection, '_', 2);
1052      first := Piece(selection, '^', 1);
1053      if first = '' then exit;     // line
1054      profileselected := strtointdef(Piece(selection, '^', 2), 0) < 0;
1055      if profileselected then
1056      begin
1057        for i := 2 to Items.Count - 1 do
1058        begin
1059          profileitem := Items[i];
1060          if length(Piece(profileitem, '_', 2)) > 0 then
1061            profileitem := Piece(profileitem, '_', 1) + ' ' + Piece(profileitem, '_', 2);   //*****???? ^
1062          AddToList(profileitem, lstItemsDisplayed);
1063        end;
1064      end
1065      else
1066        AddToList(selection, lstItemsDisplayed);
1067      if ItemIndex = 0 then Clear;        //profile or type <any>
1068      ItemIndex := -1;
1069    end;
1070  end;
1071  
1072  procedure TfrmGraphProfiles.CheckToClear;
1073  begin
1074    if (cboAllItems.Visible and (cboAllItems.Items.Count = 0))
1075    or (lstItemsSelection.Visible and (lstItemsSelection.Items.Count = 0)) then
1076    begin
1077      lstSources.ItemIndex := -1;
1078      lstOtherSources.ItemIndex := -1;
1079      btnAdd.Enabled := false;
1080      btnAddAll.Enabled := false;
1081    end;
1082  end;
1083  
1084  procedure TfrmGraphProfiles.QualifierDelete(line: string);
1085  var
1086    i: integer;
1087    filenum: string;
1088  begin
1089    if Piece(line, '^', 1) <> '0' then exit;
1090    filenum := Piece(line, '^', 2);
1091    if strtointdef(filenum, 0) < 0 then exit;
1092    if (filenum = '52') or (filenum = '55') or (filenum = '55NVAE')
1093    or (filenum = '55NVA') or (filenum = '53.79') then
1094    with lstItemsDisplayed do
1095    for i := 0 to Items.Count - 1 do
1096    if (Piece(Items[i], '^', 2) = '50.605') and (Piece(Items[i], '^', 1) = '0') then
1097    begin
1098      Items.Delete(i);
1099      break;
1100    end;
1101  end;
1102  
1103  procedure TfrmGraphProfiles.AllItemsBefore(var typedata: string);
1104  var
1105    i: integer;
1106  begin
1107    with cboAllItems.Items do
1108    begin
1109      Clear;
1110      cboAllItems.InitLongList('');
1111      typedata := '0^' + Piece(typedata, '^', 1) + '^ ' + Piece(typedata, '^', 2) + ' <any>';
1112      Insert(0, typedata);
1113      Insert(1, '^' + LLS_LINE);
1114      if Piece(typedata, '^', 2) = '63AP' then
1115      begin
1116        for i := 0 to lstSources.Items.Count - 1 do
1117        if copy(lstSources.Items[i], 1, 5) = '63AP;' then
1118        begin
1119          typedata := lstSources.Items[i];
1120          typedata := '0^' + Piece(typedata, '^', 1) + '^ ' + Piece(typedata, '^', 2) + ' <any>';
1121          Add(typedata);
1122        end;
1123      end
1124      else if Piece(typedata, '^', 2) ='63MI' then
1125      begin
1126        for i := 0 to lstSources.Items.Count - 1 do
1127        if copy(lstSources.Items[i], 1, 5) = '63MI;' then
1128        begin
1129          typedata := lstSources.Items[i];
1130          typedata := '0^' + Piece(typedata, '^', 1) + '^ ' + Piece(typedata, '^', 2) + ' <any>';
1131          Add(typedata);
1132        end;
1133      end;
1134    end;
1135  end;
1136  
1137  procedure TfrmGraphProfiles.AllItemsAfter(var filetype, typedata: string);
1138  var
1139    i: integer;
1140    itemdata: string;
1141  begin
1142    with lstItemsSelection.Items do
1143    begin
1144      Clear;
1145      lstItemsSelection.Sorted := true;
1146      //typedata := '0^' + Piece(typedata, '^', 1) + '^ ' + Piece(typedata, '^', 2) + ' <any>';
1147      typedata := '0^' + Piece(typedata, '^', 1) + '^ ' + Piece(typedata, '^', 3);
1148      Insert(0, typedata);
1149      Insert(1, '^' + LLS_LINE);
1150      if filetype = '63AP' then                         // finish subitems ***********
1151      begin
1152        lstItemsSelection.Sorted := false;
1153        for i := 0 to lstSources.Items.Count - 1 do
1154        if copy(lstSources.Items[i], 1, 5) = '63AP;' then
1155        begin
1156          typedata := lstSources.Items[i];
1157          typedata := '0^' + Piece(typedata, '^', 1) + '^ ' + Piece(typedata, '^', 2) + ' <any>';
1158          Add(typedata);
1159        end;
1160      end
1161      else if filetype ='63MI' then
1162      begin
1163        lstItemsSelection.Sorted := false;
1164        for i := 0 to lstSources.Items.Count - 1 do
1165        if copy(lstSources.Items[i], 1, 5) = '63MI;' then
1166        begin
1167          typedata := lstSources.Items[i];
1168          typedata := '0^' + Piece(typedata, '^', 1) + '^ ' + Piece(typedata, '^', 2) + ' <any>';
1169          Add(typedata);
1170        end;
1171      end
1172      else if filetype = '50.605' then
1173      for i := 0 to lstDrugClass.Items.Count - 1 do
1174      begin
1175        itemdata := lstDrugClass.Items[i];
1176        if filetype = Piece(itemdata, '^', 1) then
1177          Add(itemdata);
1178      end
1179      else if copy(filetype, 1, 5) = '63AP;' then
1180      begin
1181        filetype := copy(filetype, 1, 4) + '^A;' + copy(filetype, 6, 1) + ';';
1182        for i := 0 to lstTests.Items.Count - 1 do
1183        begin
1184          itemdata := lstTests.Items[i];
1185          if filetype = UpperCase(copy(itemdata, 1, 9)) then
1186            Add(itemdata);
1187        end;
1188      end
1189      else if copy(filetype, 1, 5) = '63MI;' then
1190      begin
1191        filetype := copy(filetype, 1, 4) + '^M;' + copy(filetype, 6, 1) + ';';
1192        for i := 0 to lstTests.Items.Count - 1 do
1193        begin
1194          itemdata := lstTests.Items[i];
1195          if filetype = UpperCase(copy(itemdata, 1, 9)) then
1196            Add(itemdata);
1197        end;
1198      end
1199      else if filetype <> '405' then
1200      for i := 0 to lstTests.Items.Count - 1 do
1201      begin
1202        itemdata := lstTests.Items[i];
1203        if filetype = UpperCase(Piece(itemdata, '^', 1)) then
1204          Add(itemdata);
1205      end;
1206      cboAllItemsChange(lstItemsSelection);
1207    end;
1208  end;
1209  
1210  procedure TfrmGraphProfiles.AddToList(aItem: string; aListBox: TORListBox);
1211  var
1212    addtolist: boolean;
1213    checkfile, checkitem: string;
1214  begin
1215    aItem := UpperCase(Pieces(aItem, '^', 1, 2)) + '^' + Piece(aItem, '^', 3);
1216    checkfile := Piece(aItem, '^', 1);
1217    checkitem := Piece(aItem, '^', 2);
1218    if checkfile = '0' then
1219    begin
1220      checkfile := checkitem;       // if drug class any - 52,0;55,0
1221      checkitem := '0';           // if drug class item - go thru meds
1222    end;
1223    ArrangeList(checkfile, checkitem, aItem, aListBox, addtolist);
1224    if addtolist then aListBox.Items.Add(aItem);
1225    if (checkfile = '50.605') and (checkitem = '0') then
1226    begin
1227      checkfile := '52';
1228      aItem := '0^52^ Medication,Outpatitent <any>';
1229      ArrangeList(checkfile, checkitem, aItem, aListBox, addtolist);
1230      if addtolist then aListBox.Items.Add(aItem);
1231      checkfile := '55';
1232      aItem := '0^55^ Medication,Inpatitent <any>';
1233      ArrangeList(checkfile, checkitem, aItem, aListBox, addtolist);
1234      if addtolist then aListBox.Items.Add(aItem);
1235      checkfile := '53.79';
1236      aItem := '0^53.79^ Medication,BCMA <any>';
1237      ArrangeList(checkfile, checkitem, aItem, aListBox, addtolist);
1238      if addtolist then aListBox.Items.Add(aItem);
1239      {checkfile := '55NVAE';               // nonvameds as events is not used
1240      aItem := '0^55NVAE^ Medication,Non-VA-Event <any>';
1241      ArrangeList(checkfile, checkitem, aItem, aListBox, addtolist);
1242      if addtolist then aListBox.Items.Add(aItem);}
1243      checkfile := '55NVA';
1244      aItem := '0^55NVA^ Medication,Non-VA <any>';
1245      ArrangeList(checkfile, checkitem, aItem, aListBox, addtolist);
1246      if addtolist then aListBox.Items.Add(aItem);
1247    end;
1248  end;
1249  
1250  procedure TfrmGraphProfiles.ArrangeList(aCheckFile, aCheckItem, aItem: string;
1251    aListBox: TORListBox; var addtolist: boolean);
1252  var
1253    i: integer;
1254    listfile, listitem: string;
1255  begin
1256    addtolist := true;
1257    with aListBox do
1258    for i := Items.Count - 1 downto 0 do
1259    begin
1260      listfile := Piece(Items[i], '^', 1);
1261      listitem := Piece(Items[i], '^', 2);
1262      if listfile = '0' then
1263      begin
1264        listfile := listitem;
1265        listitem := '0';
1266      end;
1267      if (aCheckItem = listitem) and (aCheckFile = listfile) then
1268      begin
1269        addtolist := false;
1270        break;
1271      end
1272      else
1273      if (listitem = '0') and (aCheckFile = listfile) then
1274      begin
1275        addtolist := false;
1276        break;
1277      end
1278      else
1279      if listitem = '0' then
1280      begin
1281        if aCheckFile = Piece(listfile, ';', 1) then
1282          if Piece(aCheckItem, ';', 2) = Piece(listfile, ';', 2) then
1283          begin
1284            addtolist := false;
1285            break;
1286          end;
1287      end
1288      else
1289      if (aCheckItem = '0') and (aCheckFile = listfile) then
1290        Items.Delete(i);
1291    end;
1292  end;
1293  
1294  // CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
1295  procedure TfrmGraphProfiles.AssignProfile(aList: TStrings; aProfile: string; UserNum: int64; allitems: boolean);
1296  var
1297    i, k: integer;
1298    preprofile, typedata, typepart, typeone, typetwo, testname, teststring: string;
1299    itempart, itempart1, itempart2, itemnums, itemname, itemtest: string;
1300  begin
1301    preprofile := aProfile;
1302    aList.Clear;
1303    if Piece(aProfile, '^', 1) = VIEW_TEMPORARY then
1304    begin
1305      typedata := Piece(aProfile, '^', 3);
1306      for i := 1 to BIG_NUMBER do
1307      begin
1308        typepart := Piece(typedata, '|', i);
1309        if typepart = '' then
1310          break;
1311        testname := Piece(aProfile, '^', i + 3);
1312        typeone := Piece(typepart, '~', 1);
1313        typetwo := Piece(typepart, '~', 2);
1314        aList.Add(typeone + '^' + typetwo + '^' + testname);
1315      end;
1316      typedata := '0^' + Piece(aProfile, '^', 1) + '^ ' + Piece(aProfile, '^', 2);
1317      aList.Insert(0, typedata);
1318      aList.Insert(1, '^' + LLS_LINE);
1319      exit;
1320    end;
1321    if Piece(aProfile, '^', 1) = VIEW_CURRENT then   // current selection on list
1322    begin
1323      typedata := '0^-1^ ' + Piece(aProfile, '^', 2);
1324      aProfile := Piece(aProfile, '^', 3);
1325      aList.Add(typedata);
1326      aList.Add('^' + LLS_LINE);
1327      for i := 1 to BIG_NUMBER do
1328      begin
1329        itempart := Piece(aProfile, '|', i);
1330        if itempart = '' then exit;
1331        itempart1 := Piece(itempart, '~', 1);
1332        itempart2 := Piece(itempart, '~', 2);
1333        itemnums := itempart1 + '^' + itempart2;
1334        itemname := '';
1335        for k := 0 to GtslItems.Count - 1 do
1336        begin
1337          itemtest := UpperCase(Pieces(GtslItems[k], '^', 1, 2));
1338          if Piece(itemtest, '^', 1) = '63' then
1339            itemtest := Piece(itemtest, '.', 1);
1340          if itemtest = itemnums then
1341          begin
1342            itemname := Piece(GtslItems[k], '^', 4);
1343            itemname := Piece(itemname, '(', 1);   // removes specimen parens on name
1344            itemname := Piece(itemname, '[', 1);   // removes refrange bracket on name
1345            itemname := trim(itemname);
1346            itemnums := itemnums + '^' + itemname;
1347            aList.Add(itemnums);
1348            break;
1349          end;
1350        end;
1351      end;
1352      typedata := '0^' + Piece(aProfile, '^', 1) + '^ ' + Piece(aProfile, '^', 2);
1353      aList.Insert(0, typedata);
1354      aList.Insert(1, '^' + LLS_LINE);
1355      exit;
1356    end;
1357    if radSourceAll.Checked or allitems then
1358    begin
1359      AssignProfilePre(aList, aProfile, UserNum);
1360      for i := 0 to aList.Count - 1 do
1361      begin
1362        teststring := aList[i];
1363        if Piece(teststring, '^', 1) = '0' then
1364          aList[i] := '0^' + Piece(teststring, '^', 2) + '^_' + Piece(teststring, '^', 3);
1365      end;
1366      typedata := '0^' + Piece(aProfile, '^', 1) + '^ ' + Piece(aProfile, '^', 2);
1367      aList.Insert(0, typedata);
1368      aList.Insert(1, '^' + LLS_LINE);
1369      exit;
1370    end;
1371    if Piece(aProfile, '^', 1) = VIEW_LABS then
1372    begin
1373      lstScratch.Items.Clear;
1374      FastAssign(GetATestGroup(strtointdef(Piece(Piece(aProfile, '^', 2), ')', 1), -1), UserNum), aList);
1375      for i  := 0 to aList.Count - 1 do
1376        aList[i] := '63^' + aList[i];
1377    end
1378    else
1379    if Piece(aProfile, '^', 1) = VIEW_PUBLIC then
1380    begin
1381      FastAssign(GetGraphProfiles(UpperCase(Piece(aProfile, '^', 2)), '1', 0, 0), lstScratch.Items);
1382      typedata := '0^-1^ ' + Piece(aProfile, '^', 2);
1383    end
1384    else
1385    begin
1386      FastAssign(GetGraphProfiles(UpperCase(Piece(aProfile, '^', 2)), '0', 0, UserNum), lstScratch.Items);
1387      typedata := '0^' + Piece(aProfile, '^', 1) + '^ ' + Piece(aProfile, '^', 2);
1388    end;
1389    if Piece(aProfile, '^', 1) = VIEW_LABS then
1390      exit;
1391    for i := 0 to lstScratch.Items.Count - 1 do
1392      aProfile := aProfile + lstScratch.Items[i];
1393    aProfile := Piece(aProfile, '^', 3);
1394    AssignProfilePost(aList, aProfile, typedata);
1395  end;
1396  
1397  // CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
1398  procedure TfrmGraphProfiles.AssignProfilePre(aList: TStrings; var aProfile: string; UserNum: int64);
1399  var
1400    i: integer;
1401  begin
1402    if Piece(aProfile, '^', 1) = VIEW_LABS then
1403    begin
1404      FastAssign(GetATestGroup(strtointdef(Piece(Piece(aProfile, '^', 2), ')', 1), -1), UserNum), aList);
1405      for i  := 0 to aList.Count - 1 do
1406        aList[i] := '63^' + aList[i];
1407    end
1408    else
1409    if Piece(aProfile, '^', 1) = VIEW_PUBLIC then
1410      FastAssign(GetGraphProfiles(UpperCase(Piece(aProfile, '^', 2)), '1', 1, 0), aList)
1411    else
1412    if Piece(aProfile, '^', 1) = VIEW_PERSONAL then
1413      FastAssign(GetGraphProfiles(UpperCase(Piece(aProfile, '^', 2)), '0', 1, UserNum), aList)
1414    else
1415      FastAssign(GetGraphProfiles(UpperCase(Piece(aProfile, '^', 2)), '0', 1, UserNum), aList);
1416  end;
1417  
1418  procedure TfrmGraphProfiles.AssignProfilePost(aList: TStrings; var aProfile, typedata: string);
1419  var
1420    stop: boolean;
1421    i, j, k: integer;
1422    itempart, itempart1, itempart2, itemnums, itemname, itemtest: string;
1423  begin
1424    aList.Clear;
1425    aList.Add(typedata);
1426    aList.Add('^' + LLS_LINE);
1427    for i := 1 to BIG_NUMBER do
1428    begin
1429      itempart := Piece(aProfile, '|', i);
1430      if itempart = '' then exit;
1431      itempart1 := Piece(itempart, '~', 1);
1432      itempart2 := Piece(itempart, '~', 2);
1433      itemnums := itempart1 + '^' + itempart2;
1434      itemname := '';
1435      if itempart1 = '0' then
1436      begin
1437        for j := 0 to lstSources.Items.Count - 1 do
1438          if itempart2 = Piece(lstSources.Items[j], '^', 1) then
1439          begin
1440            itemname := Piece(lstSources.Items[j], '^', 2);
1441            break;
1442          end;
1443        typedata := '0^' + itempart2 + '^_' + itemname + ' <any>';
1444        aList.Add(typedata);
1445      end
1446      else
1447      if (itempart1 <> '0') then    //DRUG CLASS NOT INCLUDED
1448      begin
1449        stop := false;
1450        for k := 0 to lstTests.Items.Count - 1 do
1451        begin
1452          itemtest := UpperCase(Pieces(lstTests.Items[k], '^', 1, 2));
1453          if itemtest = itemnums then
1454          begin
1455            itemname := Piece(lstTests.Items[k], '^', 3);
1456            itemnums := itemnums + '^' + itemname;
1457            aList.Add(itemnums);
1458            stop := true;
1459            break;
1460          end;
1461        end;
1462        if not stop then
1463        for k := 0 to lstDrugClass.Items.Count - 1 do
1464        begin
1465          itemtest := UpperCase(Pieces(lstDrugClass.Items[k], '^', 1, 2));
1466          if itemtest = itemnums then
1467          begin
1468            itemname := Piece(lstDrugClass.Items[k], '^', 3);
1469            itemnums := itemnums + '^' + itemname;
1470            aList.Add(itemnums);
1471            break;
1472          end;
1473        end;
1474      end;
1475    end;
1476  end;
1477  
1478  procedure TfrmGraphProfiles.FillSource(aList: TORListBox);
1479  var
1480    i: integer;
1481  // CQ #15852 - Changed UserNum to Int64 for a long DUZ - JCS
1482    UserNum: Int64;
1483    dfntype, firstline, listline: string;
1484  begin
1485    with aList do
1486    begin
1487      Clear;
1488      firstline := '';
1489      Sorted := true;
1490      OnClick := OnChange;     // turn off onchange event when loading
1491      OnChange := nil;
1492      if aList = lstSources then                  // user
1493      begin
1494        FastAssign(rpcGetTypes('0', true), Items);   //*** use GtslAllTypes ???
1495        for i := 0 to Items.Count - 1 do
1496        begin
1497          listline := Items[i];
1498          dfntype := UpperCase(Piece(listline, '^', 1));
1499          SetPiece(listline, '^', 1, dfntype);
1500          Items[i] := listline;
1501        end;
1502        Sorted := false;
1503        Items.Insert(0, LLS_FRONT + copy('Types' + LLS_BACK, 0, 30) + '^0');
1504        UserNum := User.DUZ;
1505        if GtslViews.Count > 0 then
1506        begin
1507          Items.Add(LLS_FRONT + copy('Temporary Views' + LLS_BACK, 0, 30) + '^0');
1508          for i := 0 to GtslViews.Count - 1 do
1509          begin
1510            listline := GtslViews[i];
1511            if Piece(listline, '^', 1) = VIEW_CURRENT then
1512              Items.Add(listline)
1513            else
1514              Items.Add(VIEW_TEMPORARY + '^' + listline + '^');
1515          end;
1516        end;
1517      end
1518      else                                         // other user
1519      begin
1520        UserNum := cboUser.ItemIEN;
1521        Sorted := false;
1522      end;
1523      FastAssign(GetGraphProfiles('1', '0', 0, UserNum), lstScratch.Items);
1524      lstScratch.Sorted := true;
1525      if lstScratch.Items.Count > 0 then
1526      begin
1527        Items.Add(LLS_FRONT + copy('Personal Views' + LLS_BACK, 0, 30) + '^0');
1528        for i := 0 to lstScratch.Items.Count - 1 do
1529          Items.Add(VIEW_PERSONAL + '^' + lstScratch.Items[i] + '^');
1530      end;
1531      FastAssign(GetGraphProfiles('1', '1', 0, 0), lstScratch.Items);
1532      lstScratch.Sorted := true;
1533      if (lstScratch.Items.Count > 0) and (aList = lstSources) then
1534      begin
1535        Items.Add(LLS_FRONT + copy('Public Views' + LLS_BACK, 0, 30) + '^0');
1536        for i := 0 to lstScratch.Items.Count - 1 do
1537          Items.Add(VIEW_PUBLIC + '^' + lstScratch.Items[i] + '^');
1538      end;
1539      FastAssign(rpcTestGroups(UserNum), lstScratch.Items);
1540      lstScratch.Sorted := true;
1541      if lstScratch.Items.Count > 0 then
1542      begin
1543        Items.Add(LLS_FRONT + copy('Lab Groups' + LLS_BACK, 0, 30) + '^0');
1544        for i := 0 to lstScratch.Items.Count - 1 do
1545          Items.Add(VIEW_LABS + '^' + Piece(lstScratch.Items[i], '^', 2) + '^' + Piece(lstScratch.Items[i], '^', 1));
1546      end;
1547      OnChange := OnClick;
1548      OnClick := nil;
1549    end;
1550  end;
1551  
1552  function TfrmGraphProfiles.ProfileExists(aName, aType: string): boolean;
1553  var
1554    i: integer;
1555    info, sourcetype, profilename: string;
1556  begin
1557    Result := false;
1558    aName := UpperCase(aName);
1559    for i := lstSources.Items.Count - 1 downto 0 do
1560    begin
1561      info := lstSources.Items[i];
1562      profilename := Piece(info, '^', 2);
1563      sourcetype := Piece(info, '^', 1);
1564      if (UpperCase(profilename) = aName) and (aType = sourcetype) then
1565      begin
1566        Result := true;
1567        break;
1568      end;
1569    end;
1570  end;
1571  
1572  procedure TfrmGraphProfiles.AssignHints;
1573  var
1574    i: integer;
1575  begin                       // text defined in uGraphs
1576    for i := 0 to ControlCount - 1 do with Controls[i] do
1577      Controls[i].ShowHint := true;
1578    RadSourcePat.Hint := HINT_PAT_SOURCE;
1579    RadSourceAll.Hint := HINT_ALL_SOURCE;
1580    lblSelectionInfo.Hint := HINT_SELECTION_INFO;
1581    lblSource.Hint := HINT_SOURCE;
1582    lstSources.Hint := HINT_SOURCE;
1583    pnlSources.Hint := HINT_SOURCE;
1584    pnlAllSources.Hint := HINT_SOURCE;
1585    splViews.Hint := HINT_SOURCE;
1586    lblSelectOthers.Hint := HINT_OTHER_SOURCE;
1587    lblOtherViews.Hint := HINT_OTHER_SOURCE;
1588    lstOtherSources.Hint := HINT_OTHER_SOURCE;
1589    pnlOtherSources.Hint := HINT_OTHER_SOURCE;
1590    pnlOtherSourcesBottom.Hint := HINT_OTHER_SOURCE;
1591    pnlOtherViews.Hint := HINT_OTHER_SOURCE;
1592    lblOtherViews.Hint := HINT_OTHER_SOURCE;
1593    lblSelectOthers.Hint := HINT_OTHER_SOURCE;
1594    lblOtherPersons.Hint := HINT_OTHERS;
1595    cboUser.Hint := HINT_OTHERS;
1596    pnlOtherSourcesUser.Hint := HINT_OTHERS;
1597    btnDefinitions.Hint := HINT_BTN_DEFINITION;
1598    lblSelection.Hint := HINT_SELECTION;
1599    lstItemsSelection.Hint := HINT_SELECTION;
1600    cboAllItems.Hint := HINT_SELECTION;
1601    lblDisplay.Hint := HINT_DISPLAY;
1602    lstItemsDisplayed.Hint := HINT_DISPLAY;
1603    btnAddAll.Hint := HINT_BTN_ADDALL;
1604    btnAdd.Hint := HINT_BTN_ADD1;
1605    btnRemoveOne.Hint := HINT_BTN_REMOVE1;
1606    btnRemoveAll.Hint := HINT_BTN_REMOVEALL;
1607    btnClear.Hint := HINT_BTN_CLEAR;
1608    btnDelete.Hint := HINT_BTN_DELETE;
1609    btnRename.Hint := HINT_BTN_RENAME;
1610    btnSave.Hint := HINT_BTN_SAVE;
1611    btnSavePublic.Hint := HINT_BTN_SAVE_PUB;
1612    pnlApply.Hint := HINT_APPLY;
1613    btnClose.Hint := HINT_BTN_CLOSE;
1614  end;
1615  
1616  procedure TfrmGraphProfiles.wmNCLButtonDown(var Msg: TWMNCLButtonDown);
1617  begin            // clicking the ? button will have controls show hints
1618    if Msg.HitTest = HTHELP then
1619    begin
1620      Msg.Result := 0; // ignore biHelp border icon
1621      AssignHints;
1622      ShowMsg('Help is now available.' + #13 +
1623                  'By pausing over a list or control, hints will appear.');
1624    end
1625    else
1626      inherited;
1627  end;
1628  
1629  function TfrmGraphProfiles.GetProfileName(infotitle, info: string; var newprofilename: string): boolean;
1630  begin
1631    Result := InputQuery(infotitle, info, newprofilename);
1632    if not Result then exit;
1633    if newprofilename = '' then
1634    begin
1635      Result := false;
1636      exit;
1637    end;
1638    if (length(newprofilename) < 3)
1639    or (length(newprofilename) > 30)
1640    or (Pos('^', newprofilename) > 0)
1641    or (Pos('|', newprofilename) > 0)
1642    or (Pos('~', newprofilename) > 0) then
1643    begin
1644      ShowMsg('Not accepted - names of views must be 3-30 characters.');
1645      Result := false;
1646      exit;
1647    end;
1648  end;
1649  
1650  procedure TfrmGraphProfiles.IDProfile(var profilename, proftype: string);
1651  var
1652    i, match: integer;
1653    info, aName, aType: string;
1654  begin
1655    if length(profilename) > 0 then
1656      lblSave.Hint := profilename;
1657    btnClearClick(self);
1658    lstScratch.Items.Clear;
1659    lstSources.Items.Clear;
1660    GraphDataOnUser;
1661    FormShow(btnSave);
1662    match := -1;
1663    profilename := UpperCase(profilename);
1664    for i := lstSources.Items.Count - 1 downto 0 do
1665    begin
1666      info := lstSources.Items[i];
1667      aType := Piece(info, '^', 1);
1668      aName := Piece(info, '^', 2);
1669      if (UpperCase(aName) = profilename) and (aType = proftype) then
1670      begin
1671        match := i;
1672        break;
1673      end;
1674    end;
1675    if match = -1 then exit;
1676    lstSources.ItemIndex := match;
1677    lstSources.Tag := BIG_NUMBER;
1678    lstSourcesChange(lstSources);
1679  end;
1680  
1681  end.

Module Calls (2 levels)


fGraphProfiles
 ├uGraphs
 ├rCore
 │ └uCore
 ├uCore...
 ├fBase508Form
 │ ├uConst
 │ └uHelpManager
 ├rGraphs
 ├fGraphData
 │ ├fBase508Form...
 │ ├uCore...
 │ ├rGraphs
 │ └uGraphs
 ├fGraphOthers
 │ ├uCore...
 │ ├fBase508Form...
 │ └rLabs
 └fRptBox
   ├fFrame
   ├fBase508Form...
   ├uReports
   └rReports

Module Called-By (2 levels)


fGraphProfiles
     fGraphs┤ 
    fFrame┤ │ 
  fReports┘ │ 
    fOptions┘ 
 fFrame...┘