Function

SelectService

Module

fConsultBS

Last Modified

7/15/2014 3:26:34 PM

Comments

Displays service select form for consults and returns a record of the selection

Scope

Interfaced

Declaration

function SelectService(FontSize: Integer; CurrentContext: TSelectContext; var ServiceContext: TServiceContext): boolean;

Calls Hierarchy


SelectService
 ├TfrmBase508Form.Create
 │ ├TfrmBase508Form.UpdateAccessibilityActions
 │ ├UnfocusableControlEnter
 │ └AdjustControls
 │   ├TfrmBase508Form.ModifyUnfocusableControl
 │   └..(rec)..
 ├BuildServiceTree
 └TfrmConsultsByService.cboServiceSelect

Called-By Hierarchy


                                 SelectService
                   TfrmConsults.mnuViewClick┘ 
               TfrmConsults.SetViewContext┘   
                TfrmConsults.DisplayPage┤     
TfrmConsults.mnuViewReturntoDefaultClick┘     

Calls

Name Declaration Comments
BuildServiceTree procedure BuildServiceTree(Tree: TORTreeView; SvcList: TStrings; const Parent: string; Node: TORTreeNode); -
TfrmConsultsByService.cboServiceSelect procedure cboServiceSelect(Sender: TObject); -
TfrmBase508Form.Create constructor Create(AOwner: TComponent); override; -

Called-By

Name Declaration Comments
TfrmConsults.mnuViewClick procedure mnuViewClick(Sender: TObject); -


Source

56    function SelectService(FontSize: Integer; CurrentContext: TSelectContext; var ServiceContext: TServiceContext): boolean;
57    { displays service select form for consults and returns a record of the selection }
58    var
59      frmConsultsByService: TfrmConsultsByService;
60      W, H, i: Integer;
61      CurrentService: string;
62    begin
63      frmConsultsByService := TfrmConsultsByService.Create(Application);
64      try
65        with frmConsultsByService do
66        begin
67          Font.Size := FontSize;
68          W := ClientWidth;
69          H := ClientHeight;
70          ResizeToFont(FontSize, W, H);
71          ClientWidth  := W; pnlBase.Width  := W;
72          ClientHeight := H; pnlBase.Height := H;
73          FChanged := False;
74          //FastAssign(LoadServiceList(CN_SVC_LIST_DISP), SvcList);                         {RV}
75          FastAssign(LoadServiceListWithSynonyms(CN_SVC_LIST_DISP), SvcList);             {RV}
76          SortByPiece(TStringList(SvcList), U, 2);                                   {RV}
77          for i := 0 to SvcList.Count - 1 do
78            if cboService.Items.IndexOf(Trim(Piece(SvcList.Strings[i], U, 2))) = -1 then   {RV}
79            //if cboService.SelectByID(Piece(SvcList.Strings[i], U, 1)) = -1 then
80              cboService.Items.Add(SvcList.Strings[i]);
81          BuildServiceTree(treService, SvcList, '0', nil) ;
82          with treService do
83            for i := 0 to Items.Count-1 do
84              begin
85                if Items[i].Level > 0 then Items[i].Expanded := False else Items[i].Expanded := True;
86                TopItem := Items[0] ;
87                Selected := Items[0] ;
88              end ;
89          FAscending := CurrentContext.Ascending;
90          radSort.ItemIndex := Ord(not FAscending);
91          CurrentService := CurrentContext.Service;
92          if StrToIntDef(CurrentService, 0) > 0 then
93            begin
94              cboservice.SelectByID(CurrentService);
95              cboServiceSelect(frmConsultsByService);
96            end;
97          ShowModal;
98          with ServiceContext do
99          begin
100           Changed := FChanged;
101           Service := FService;
102           ServiceName := FServiceName;
103           Ascending := FAscending;
104           ConsultUser := FConsultUser ;
105           Result := Changed ;
106         end; {with ServiceContext}
107       end; {with frmConsultsByService}
108     finally
109       frmConsultsByService.Release;
110     end;
111   end;