Index: cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fPtDemoEdit.pas
===================================================================
--- cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fPtDemoEdit.pas	(revision 793)
+++ cprs/branches/tmg-cprs/CPRS-Chart/TMG_Extra/fPtDemoEdit.pas	(revision 819)
@@ -6,5 +6,5 @@
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
-  Dialogs, ComCtrls, StdCtrls, ExtCtrls, DKLang, Grids;
+  Dialogs, ComCtrls, StdCtrls, ExtCtrls, DKLang, Grids, SortStringGrid;
 
 type
@@ -23,5 +23,5 @@
   TGridInfo = class (TObject)
   public
-    Grid      : TStringGrid;  //doesn't own object
+    Grid      : TSortStringGrid;  //doesn't own object
     FileNum   : string;
     IENS      : string;
@@ -150,5 +150,5 @@
     EMailEdit: TEdit;
     Advanced: TTabSheet;
-    gridPatientDemo: TStringGrid;
+    gridPatientDemo: TSortStringGrid;
     procedure AliasComboBoxChange(Sender: TObject);
     procedure FormCreate(Sender: TObject);
@@ -219,5 +219,5 @@
     procedure ShowPtInfo(Patient : TPatientInfo);
     function CombinedName : string;
-    procedure AddGridInfo(Grid: TStringGrid;
+    procedure AddGridInfo(Grid: TSortStringGrid;
                                   Data : TStringList;
                                   BasicMode : boolean;
@@ -228,11 +228,11 @@
     procedure SetModified(value : boolean);
     procedure SetAliasEnabled(value : boolean);
-    function PostChanges(Grid : TStringGrid) : TModalResult;
-    procedure CompileChanges(Grid : TStringGrid; CurrentUserData,Changes : TStringList);
+    function PostChanges(Grid : TSortStringGrid) : TModalResult;
+    procedure CompileChanges(Grid : TSortStringGrid; CurrentUserData,Changes : TStringList);
     procedure RegisterGridInfo(GridInfo : TGridInfo);
   public
     { Public declarations }
-    function GetInfoForGrid(Grid : TStringGrid) : TGridInfo;
-    procedure LoadAnyGrid(Grid : TStringGrid; BasicMode: boolean; FileNum : string;
+    function GetInfoForGrid(Grid : TSortStringGrid) : TGridInfo;
+    procedure LoadAnyGrid(Grid : TSortStringGrid; BasicMode: boolean; FileNum : string;
                                   IENS : string;
                                   CurrentData : TStringList);
@@ -240,10 +240,10 @@
     function IsWPField(FileNum,FieldNum : string) : boolean;
     function IsSubFile(FieldDef: string ; var SubFileNum : string) : boolean;
-    function GetInfoIndexForGrid(Grid : TStringGrid) : integer;
+    function GetInfoIndexForGrid(Grid : TSortStringGrid) : integer;
     function PostVisibleGrid: TModalResult;
-    function GetLineInfo(Grid : TStringGrid; CurrentUserData : TStringList; ARow: integer) : tFileEntry;
+    function GetLineInfo(Grid : TSortStringGrid; CurrentUserData : TStringList; ARow: integer) : tFileEntry;
     procedure GetOneRecord(FileNum, IENS : string; Data, BlankFileInfo: TStringList);
     //procedure GridSelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
-    function GetUserLine(CurrentUserData : TStringList; Grid : TStringGrid; ARow: integer) : integer;
+    function GetUserLine(CurrentUserData : TStringList; Grid : TSortStringGrid; ARow: integer) : integer;
     function FindInStrings(fieldNum : string; Strings : TStringList; var fileNum : string) : integer;
   end;
@@ -1283,5 +1283,5 @@
   end;
 
-function TfrmPtDemoEdit.PostChanges(Grid : TStringGrid) : TModalResult;
+function TfrmPtDemoEdit.PostChanges(Grid : TSortStringGrid) : TModalResult;
   //Results:  mrNone -- no post done (not needed)
   //          mrCancel -- user pressed cancel on confirmation screen.
@@ -1338,5 +1338,5 @@
   end;
 
-  procedure TfrmPtDemoEdit.CompileChanges(Grid : TStringGrid; CurrentUserData,Changes : TStringList);
+  procedure TfrmPtDemoEdit.CompileChanges(Grid : TSortStringGrid; CurrentUserData,Changes : TStringList);
   //Output format:
   // FileNum^IENS^FieldNum^FieldName^newValue^oldValue
@@ -1449,5 +1449,5 @@
 var cmd,RPCResult : string;
     IENS : String;
-    grid : TStringGrid;
+    grid : TSortStringGrid;
 begin
 //    IENS := Patient.DFN;
@@ -1482,5 +1482,5 @@
 end;
 
-procedure TfrmPtDemoEdit.LoadAnyGrid(Grid : TStringGrid;  //the TStringGrid to load
+procedure TfrmPtDemoEdit.LoadAnyGrid(Grid : TSortStringGrid;  //the TSortStringGrid to load
                                      BasicMode: boolean;
                                      FileNum : string;
@@ -1504,5 +1504,5 @@
   //This assumes that GridInfo already has loaded info.
   var
-    Grid : TStringGrid;  //the TStringGrid to load
+    Grid : TSortStringGrid;  //the TSortStringGrid to load
     BasicMode: boolean;
     FileNum : string;
@@ -1510,5 +1510,5 @@
     CurrentData : TStringList;
 
-    procedure LoadOneLine (Grid : TStringGrid; oneEntry : string; GridRow : integer);
+    procedure LoadOneLine (Grid : TSortStringGrid; oneEntry : string; GridRow : integer);
     var
       tempFile,IENS : string;
@@ -1604,5 +1604,5 @@
   end;
 
-  function TfrmPtDemoEdit.GetInfoForGrid(Grid : TStringGrid) : TGridInfo;
+  function TfrmPtDemoEdit.GetInfoForGrid(Grid : TSortStringGrid) : TGridInfo;
   var i : integer;
   begin
@@ -1616,5 +1616,5 @@
 
 
-  function TfrmPtDemoEdit.GetInfoIndexForGrid(Grid : TStringGrid) : integer;
+  function TfrmPtDemoEdit.GetInfoIndexForGrid(Grid : TSortStringGrid) : integer;
   var s : string;
   begin
@@ -1705,5 +1705,5 @@
       GridFileNum : string;
       UserLine : integer;
-      Grid : TStringGrid;
+      Grid : TSortStringGrid;
       IEN : int64;
       IENS : string;
@@ -1713,5 +1713,5 @@
   begin
     if FLoadingGrid then exit;  //prevent pseudo-clicks during loading...
-    Grid := (Sender as TStringGrid);
+    Grid := (Sender as TSortStringGrid);
     GridInfo := GetInfoForGrid(Grid);
     if GridInfo=nil then exit;
@@ -1798,5 +1798,5 @@
   end;
 
-  function TfrmPtDemoEdit.GetLineInfo(Grid : TStringGrid; CurrentUserData : TStringList; ARow: integer) : tFileEntry;
+  function TfrmPtDemoEdit.GetLineInfo(Grid : TSortStringGrid; CurrentUserData : TStringList; ARow: integer) : tFileEntry;
   var fieldNum : string;
       oneEntry : string;
@@ -1861,5 +1861,5 @@
   end;
 
-function TfrmPtDemoEdit.GetUserLine(CurrentUserData : TStringList; Grid : TStringGrid; ARow: integer) : integer;
+function TfrmPtDemoEdit.GetUserLine(CurrentUserData : TStringList; Grid : TSortStringGrid; ARow: integer) : integer;
   var fieldNum: string;
       tempFileNum : string;
@@ -1889,5 +1889,5 @@
   end;
 
- procedure TfrmPtDemoEdit.AddGridInfo(Grid: TStringGrid;
+ procedure TfrmPtDemoEdit.AddGridInfo(Grid: TSortStringGrid;
                                   Data : TStringList;
                                   BasicMode : boolean;
