Difference between revisions of "FileMan Delphi Components/FMDC Quick Start Guide"

From VistApedia
Jump to: navigation, search
Line 43: Line 43:
 
</TABLE></tr>
 
</TABLE></tr>
  
<tr><td>Word Processing</td><td>1 [[FileMan_Delphi_Components/TFMMemo|TFMMemo]]</td></tr>
+
<tr><td>[[Word_Processing_Data_Type%7E|Word Processing]]</td><td>1 [[FileMan_Delphi_Components/TFMMemo|TFMMemo]]</td></tr>
 
<tr><td>[[Pointer_to_a_File_Data_Type%7E|Pointer]]</td><td><TABLE><TR>1 [[FileMan_Delphi_Components/TFMLister|TFMLister]] and 1 [[FileMan_Delphi_Components/TFMListBox|TFMListBox]], or</td></tr>
 
<tr><td>[[Pointer_to_a_File_Data_Type%7E|Pointer]]</td><td><TABLE><TR>1 [[FileMan_Delphi_Components/TFMLister|TFMLister]] and 1 [[FileMan_Delphi_Components/TFMListBox|TFMListBox]], or</td></tr>
  
Line 50: Line 50:
 
</table></tr>
 
</table></tr>
  
<tr><td>[[Computed_Data_Type%7E|Computed]]</td><td>1 TFMLabel</td></tr>
+
<tr><td>[[Computed_Data_Type%7E|Computed]]</td><td>1 [[FileMan_Delphi_Components/TFMLabel|TFMLabel]]</td></tr>
 
</table>
 
</table>
  
Line 57: Line 57:
 
6. Select and retrieve a record:
 
6. Select and retrieve a record:
  
a. To select a record, follow the procedure in Select a record with the [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]] custom dialog. You'll add a [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]] and [[FileMan_Delphi_Components/TFMLister|TFMLister]] [[Delphi_component|component]] to your [[Delphi_Form|form]], and add a button that calls the [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]]'s [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|Execute]] method to perform the lookup.
+
a. To select a record, follow the procedure in [[[[FileMan_Delphi_Components/TFMLookUp_Select_a_record_custom_dialog|Select a record with the TFMLookUp custom dialog]]. You'll add a [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]] and [[FileMan_Delphi_Components/TFMLister|TFMLister]] [[Delphi_component|component]] to your [[Delphi_Form|form]], and add a button that calls the [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]]'s [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|Execute]] method to perform the lookup.
b. [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]].[[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|Execute]] returns a record number. With this record number, you can retrieve the record and populate your data controls with the record's [[VA_FileMan_field|field]] values. To retrieve the record, follow the procedure in the "How to Retrieve a Record" topic. You'll call the [[FileMan_Delphi_Components/TFMGets|TFMGets]] [[FileMan_Delphi_Components/TFMGets|TFMGets_GetAndFill|GetAndFill]] method to retrieve the record and populate data controls.
+
b. [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]].[[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|Execute]] returns a record number. With this record number, you can retrieve the record and populate your data controls with the record's [[VA_FileMan_field|field]] values. To retrieve the record, follow the procedure in the "[[FileMan_Delphi_Components/Retrieve_a_Record|How to Retrieve a Record]]" topic. You'll call the [[FileMan_Delphi_Components/TFMGets|TFMGets]] [[FileMan_Delphi_Components/TFMGets|TFMGets_GetAndFill|GetAndFill]] method to retrieve the record and populate data controls.
  
 
c. The code for the button that executes [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]]'s [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|Execute]] method (step a) can also perform the retrieval (step b). The code that combines these tasks would look similar to the following:
 
c. The code for the button that executes [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]]'s [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|Execute]] method (step a) can also perform the retrieval (step b). The code that combines these tasks would look similar to the following:
Line 78: Line 78:
 
7. Set up Automated OnExit Processing:
 
7. Set up Automated OnExit Processing:
  
a. Your data controls should already be linked to a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] and a [[FileMan_Delphi_Components/TFMValidator|TFMValidator]] [[Delphi_component|component]], from following the Data Control Property Settings for All [[VA_FileMan_field_data_type|Field Type]]s guidelines when you set up each data control on your [[Delphi_Form|form]].
+
a. Your data controls should already be linked to a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] and a [[FileMan_Delphi_Components/TFMValidator|TFMValidator]] [[Delphi_component|component]], from following the [[FileMan_Delphi_Components/Data_Control_Property_Settings_For_All_Field Types|Data Control Property Settings for All Field Type]]s guidelines when you set up each data control on your [[Delphi_Form|form]].
  
b. Set every data control's coValOnExit value to True, in each control's FMCtrlOptions property.
+
b. Set every data control's coValOnExit value to True, in each control's [[FileMan_Delphi_Components/FMCtrlOptions_property|FMCtrlOptions property]].
  
 
8. Provide an event to save changes:
 
8. Provide an event to save changes:
  
a. To save changes the user makes to the record, follow the procedure in the "How to File Changes" topic. You'll add a button whose caption is something like "Save Changes." You'll add code for this button's OnClick event handler that calls your [[FileMan_Delphi_Components/TFMFiler|TFMFiler]]'s [[FileMan_Delphi_Components/TFMFiler|TFMFiler_Update|Update]] method to file changes.
+
a. To save changes the user makes to the record, follow the procedure in the "[[FileMan_Delphi_Components/How_To_File_Changes|How to File Changes]]" topic. You'll add a button whose caption is something like "Save Changes." You'll add code for this button's OnClick event handler that calls your [[FileMan_Delphi_Components/TFMFiler|TFMFiler]]'s [[FileMan_Delphi_Components/TFMFiler|TFMFiler_Update|Update]] method to file changes.
  
 
9. (Optional) Provide context-sensitive [[VA_FileMan_field|field]] help:
 
9. (Optional) Provide context-sensitive [[VA_FileMan_field|field]] help:
Line 90: Line 90:
 
You can retrieve the [[VA_FileMan_field|field]]-based help from the data dictionary in several ways:
 
You can retrieve the [[VA_FileMan_field|field]]-based help from the data dictionary in several ways:
  
* F1 [[VA_FileMan_field|field]] help in pop-up window
+
* [[FileMan_Delphi_Components/F1 field help in pop-up window
  
* F1 [[VA_FileMan_field|field]] help in pop-up window for [[FileMan_Delphi_Components/TFMRadioGroup|TFMRadioGroup]] Controls
+
* [[FileMan_Delphi_Components/F1 [[VA_FileMan_field|field]] help in pop-up window for TFMRadioGroup|TFMRadioGroup]] Controls
  
* Automatic OnFocus Display of help in a [[FileMan_Delphi_Components/TPanel|TPanel]]
+
* [[FileMan_Delphi_Components/Automatic OnFocus Display of help in a TPanel
  
* Calling a [[FileMan_Delphi_Components/TFMHelp|TFMHelp]] [[Delphi_component|component]] directly
+
* [[FileMan_Delphi_Components/Calling_A_TFMHelp_component|Calling a]][[FileMan_Delphi_Components/TFMHelp|TFMHelp]] [[Delphi_component|component]] directly
  
 
10. Register your application:
 
10. Register your application:
Line 104: Line 104:
 
The RPC multiple of this option must include the RPCs invoked by all VA FileMan Delphi Components methods that your application uses.
 
The RPC multiple of this option must include the RPCs invoked by all VA FileMan Delphi Components methods that your application uses.
  
For a listing of the RPC invoked by each VA FileMan Delphi Components method, please refer to the "Security & Registering FMDC RPCs" topic.
+
For a listing of the [[REMOTE PROCEDURE CALL|RPC]] invoked by each VA FileMan Delphi Components method, please refer to the "[[FileMan_Delphi_Components/Security_And_Registering_FMDC_RPCS|Security & Registering FMDC RPCs]]" topic.
  
 
For more information on RPC Broker security, please refer to the documentation for the [[RPC Broker]].
 
For more information on RPC Broker security, please refer to the documentation for the [[RPC Broker]].

Revision as of 19:37, 7 February 2011

This quick start guide goes immediately to the heart of the matter, showing you how to edit records in a particular file using the VA FileMan Delphi Components (FMDC).

To edit records in a given VA FileMan file with the VA FileMan Delphi Components:

1. Establish an RPC Broker connection:

a. Add a TRPCBroker component to your form.

b. Set its properties and invoke its methods as necessary to connect to a server system.

2. Add a TFMGets component to retrieve data:

a. Add a TFMGets component to your form. b. Set its RPCBroker property to point to your form's TRPCBroker component.

c. Set its FileNumber property to the file containing records to retrieve.

3. Add a TFMFiler component to file changes:

a. Add a TFMFiler component to your form.

b. Set its RPCBroker property to point to your form's TRPCBroker component.

4. Add a TFMValidator component to provide validation services:

a. Add a TFMValidator component to your form.

b. Set its RPCBroker property to point to your form's TRPCBroker component.

5. Add VA FileMan data controls for each field:

a. For each field to edit, add data control(s) and supporting data access components to your form as follows:

For this Field TypeAdd to Your Form
Free text, Numeric, Date1 TFMEdit
"Boolean" Set of Codes1 TFMCheckBox
Set of Codes
1 TFMRadioGroup, or
1 TPanel, plus 1 TFMRadioButton per code
Word Processing1 TFMMemo
Pointer1 TFMLister and 1 TFMListBox, or</td>

<tr><td>1 TFMLister and 1 TFMComboBox, or</td></tr> <tr><td>1 TFMLister and 1 TFMComboBoxLookUp</td></tr> </table></tr>

<tr><td>Computed</td><td>1 TFMLabel</td></tr> </table>

b. Set the properties of these controls and components according to the field-specific guidelines for the Field Type: Free text, numeric, date - "Boolean" set of codes - Set of Codes - Word Processing - Pointer - Computed.

6. Select and retrieve a record:

a. To select a record, follow the procedure in [[Select a record with the TFMLookUp custom dialog. You'll add a TFMLookUp and TFMLister component to your form, and add a button that calls the TFMLookUp's TFMLookUp_Execute|Execute method to perform the lookup. b. TFMLookUp.TFMLookUp_Execute|Execute returns a record number. With this record number, you can retrieve the record and populate your data controls with the record's field values. To retrieve the record, follow the procedure in the "How to Retrieve a Record" topic. You'll call the TFMGets TFMGets_GetAndFill|GetAndFill method to retrieve the record and populate data controls.

c. The code for the button that executes TFMLookUp's TFMLookUp_Execute|Execute method (step a) can also perform the retrieval (step b). The code that combines these tasks would look similar to the following: procedure TForm1.Button1Click(Sender: TObject); var AddRecord:Boolean; begin

 if FMLookup1.Execute(AddRecord) then begin
   FMGets1.IENS:=FMLookUp1.RecordNumber+',';
   // Call any TFMListBox/TFMComboBox GetList methods
   // here, before calling GetAndFill.
   FMGets1.GetAndFill;
 end
 else
   ShowMessage('No record chosen.');

end; 7. Set up Automated OnExit Processing:

a. Your data controls should already be linked to a TFMFiler and a TFMValidator component, from following the Data Control Property Settings for All Field Types guidelines when you set up each data control on your form.

b. Set every data control's coValOnExit value to True, in each control's FMCtrlOptions property.

8. Provide an event to save changes:

a. To save changes the user makes to the record, follow the procedure in the "How to File Changes" topic. You'll add a button whose caption is something like "Save Changes." You'll add code for this button's OnClick event handler that calls your TFMFiler's TFMFiler_Update|Update method to file changes.

9. (Optional) Provide context-sensitive field help:

You can retrieve the field-based help from the data dictionary in several ways:

  • [[FileMan_Delphi_Components/F1 field help in pop-up window
  • [[FileMan_Delphi_Components/F1 field help in pop-up window for TFMRadioGroup|TFMRadioGroup]] Controls
  • [[FileMan_Delphi_Components/Automatic OnFocus Display of help in a TPanel

10. Register your application:

Registering your application is part of RPC Broker security. For all users that do not possess the XUPROGMODE key, your application must register itself based on a "B"-type option in the Option file on the server.

The RPC multiple of this option must include the RPCs invoked by all VA FileMan Delphi Components methods that your application uses.

For a listing of the RPC invoked by each VA FileMan Delphi Components method, please refer to the "Security & Registering FMDC RPCs" topic.

For more information on RPC Broker security, please refer to the documentation for the RPC Broker.