Index: cprs/branches/foia-cprs/CPRS-Chart/fProbs.pas
===================================================================
--- cprs/branches/foia-cprs/CPRS-Chart/fProbs.pas	(revision 459)
+++ cprs/branches/foia-cprs/CPRS-Chart/fProbs.pas	(revision 460)
@@ -79,4 +79,15 @@
     mnuChartSurgery: TMenuItem;
     HeaderControl: THeaderControl;
+    mnuViewInformation: TMenuItem;
+    mnuViewDemo: TMenuItem;
+    mnuViewVisits: TMenuItem;
+    mnuViewPrimaryCare: TMenuItem;
+    mnuViewMyHealtheVet: TMenuItem;
+    mnuInsurance: TMenuItem;
+    mnuViewFlags: TMenuItem;
+    mnuViewReminders: TMenuItem;
+    mnuViewRemoteData: TMenuItem;
+    mnuViewPostings: TMenuItem;
+    mnuOptimizeFields: TMenuItem;
     procedure mnuChartTabClick(Sender: TObject);
     procedure lstProbPickClick(Sender: TObject);
@@ -110,4 +121,16 @@
     procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
       Y: Integer);
+    procedure ViewInfo(Sender: TObject);
+    procedure mnuViewInformationClick(Sender: TObject);
+    procedure mnuOptimizeFieldsClick(Sender: TObject);
+    procedure HeaderControlSectionClick(HeaderControl: THeaderControl;
+      Section: THeaderSection);
+    procedure HeaderControlMouseUp(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
+    procedure HeaderControlMouseDown(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
+    function getTotalSectionsWidth : integer;
+    procedure setSectionWidths;
+    procedure sptHorzMoved(Sender: TObject);
   private
     FContextString: string;
@@ -179,4 +202,7 @@
   GridColWidths: Array[0..15] of integer =(0, 5, -1, 9, 9, 0, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0);
 
+  type
+  arOrigSecWidths = array[0..15] of integer;
+
 var
   frmProblems: TfrmProblems;
@@ -185,4 +211,5 @@
   gFontWidth: Integer;
   gFixedWidth: Integer;
+  origWidths: arOrigSecWidths;
 
 implementation
@@ -544,4 +571,9 @@
                   exit;
                 end ;
+              if ProbRec.CmtIsXHTML then
+                begin
+                  InfoBox(ProbRec.CmtNoEditReason, 'Unable to add new comment', MB_ICONWARNING or MB_OK);
+                  exit;
+                end ;
               cmt := NewComment ;
               if (StrToInt(Piece(cmt, U, 1)) > 0) and (Piece(cmt, U, 3) <> '') then
@@ -882,4 +914,5 @@
   HeaderControl.Sections[AdjustCol].AutoSize := True;
   HeaderControl.Sections[AdjustCol].Width := HeaderControl.Width - cxUsed;
+  //mnuOptimizeFieldsClick(self);       //******** test making compression, proportional, or no spacing on resize
 end;
 
@@ -1586,4 +1619,5 @@
   end ;
   lstProbActsClick(Self) ;
+  mnuOptimizeFieldsClick(self);
 end;
 
@@ -1728,4 +1762,5 @@
   if Assigned(dlgProbs) then
     dlgProbs.SetFontSize( MainFontSize);
+  mnuOptimizeFieldsClick(self);
 end;
 
@@ -1810,4 +1845,11 @@
   inherited;
   wgProbData.Invalidate;
+  {FEvtColWidth := HeaderControl.Sections[0].Width;     //code from fOrders
+  RedrawSuspend(Self.Handle);
+  //RedrawOrderList;
+  RedrawActivate(Self.Handle);
+  wgProbData.Invalidate;
+  pnlRight.Refresh;
+  pnlLeft.Refresh; }
 end;
 
@@ -1929,4 +1971,106 @@
 end;
 
+procedure TfrmProblems.ViewInfo(Sender: TObject);
+begin
+  inherited;
+  frmFrame.ViewInfo(Sender);
+end;
+
+procedure TfrmProblems.mnuViewInformationClick(Sender: TObject);
+begin
+  inherited;
+  mnuViewDemo.Enabled := frmFrame.pnlPatient.Enabled;
+  mnuViewVisits.Enabled := frmFrame.pnlVisit.Enabled;
+  mnuViewPrimaryCare.Enabled := frmFrame.pnlPrimaryCare.Enabled;
+  mnuViewMyHealtheVet.Enabled := not (Copy(frmFrame.laMHV.Hint, 1, 2) = 'No');
+  mnuInsurance.Enabled := not (Copy(frmFrame.laVAA2.Hint, 1, 2) = 'No');
+  mnuViewFlags.Enabled := frmFrame.lblFlag.Enabled;
+  mnuViewRemoteData.Enabled := frmFrame.lblCirn.Enabled;
+  mnuViewReminders.Enabled := frmFrame.pnlReminders.Enabled;
+  mnuViewPostings.Enabled := frmFrame.pnlPostings.Enabled;
+end;
+
+procedure TfrmProblems.mnuOptimizeFieldsClick(Sender: TObject);
+var
+  totalSectionsWidth, unitvalue: integer;
+begin
+  totalSectionsWidth := pnlRight.Width - 3;
+  if totalSectionsWidth < 16 then exit;
+  unitvalue := round(totalSectionsWidth / 16);
+  with HeaderControl do
+  begin
+    if Sections[1].Width > 0 then Sections[1].Width := unitvalue;
+    Sections[2].Width := pnlRight.Width - (unitvalue * 11) - 5;
+    Sections[3].Width := unitvalue * 2;
+    Sections[4].Width := unitvalue * 2;
+    if Sections[6].Width > 0 then Sections[6].Width := unitvalue;
+    if Sections[7].Width > 0 then Sections[7].Width := unitvalue * 2;
+    if Sections[8].Width > 0 then Sections[8].Width := unitvalue * 2;
+    if Sections[15].Width > 0 then Sections[15].Width := unitvalue;
+  end;
+  HeaderControlSectionResize(HeaderControl, HeaderControl.Sections[0]);
+  HeaderControl.Repaint;
+end;
+
+procedure TfrmProblems.HeaderControlSectionClick(
+  HeaderControl: THeaderControl; Section: THeaderSection);
+begin
+  inherited;
+  //if Section = HeaderControl.Sections[1] then
+    mnuOptimizeFieldsClick(self);
+end;
+
+procedure TfrmProblems.HeaderControlMouseUp(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+var
+  i: integer;
+  totalSectionsWidth, originalwidth: integer;
+begin
+  inherited;
+  totalSectionsWidth := getTotalSectionsWidth;
+  if totalSectionsWidth > wgProbData.Width - 5 then
+  begin
+    originalwidth := 0;
+    for i := 0 to HeaderControl.Sections.Count - 1 do
+      originalwidth := originalwidth + origWidths[i];
+    if originalwidth < totalSectionsWidth then
+    begin
+      for i := 0 to HeaderControl.Sections.Count - 1 do
+        HeaderControl.Sections[i].Width := origWidths[i];
+      wgProbData.Invalidate;
+    end;
+  end;
+end;
+
+function TfrmProblems.getTotalSectionsWidth : integer;
+var
+  i: integer;
+begin
+  Result := 0;
+  for i := 0 to HeaderControl.Sections.Count - 1 do
+     Result := Result + HeaderControl.Sections[i].Width;
+end;
+
+procedure TfrmProblems.HeaderControlMouseDown(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+begin
+  inherited;
+  setSectionWidths;
+end;
+
+procedure TfrmProblems.setSectionWidths;
+var
+  i: integer;
+begin
+  for i := 0 to 15 do
+     origWidths[i] := HeaderControl.Sections[i].Width;
+end;
+
+procedure TfrmProblems.sptHorzMoved(Sender: TObject);
+begin
+  inherited;
+  mnuOptimizeFieldsClick(self);
+end;
+
 end.
 
