TORComboBox Example

From VistApedia
Jump to: navigation, search

Here is an example from CPRS of how patients are selected by starting to type in the name, and the list of available entries is retrieved from the server.


 TORComboBox
 
 Event OnNeedData
 --> cboPatientNeedData
 
 procedure TfrmPtLabelPrint.cboPatientNeedData(Sender: TObject;
                                               const StartFrom: String; 
                                               Direction, InsertAt: Integer);
 ...
       PatientList.Assign(SubSetOfPatients(NoAlias, Direction));
 ...


 {found in rCore}
 function SubSetOfPatients(const StartFrom: string; Direction: Integer): TStrings;
 { returns a pointer to a list of patients (for use in a long list box) -  The return value is
   a pointer to RPCBrokerV.Results, so the data must be used BEFORE the next broker call! }
 begin
   CallV('ORWPT LIST ALL', [StartFrom, Direction]);
   MixedCaseList(RPCBrokerV.Results);
   Result := RPCBrokerV.Results;
 end;
 Pretty sure the returned format it:
 
 IEN^Name
 IEN^Name
 IEN^Name