Ignore:
Timestamp:
Jul 6, 2008, 8:20:14 PM (16 years ago)
Author:
Kevin Toppenberg
Message:

Uploading from OR_30_258

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/branches/foia-cprs/CPRS-Chart/fProbs.pas

    r459 r460  
    7979    mnuChartSurgery: TMenuItem;
    8080    HeaderControl: THeaderControl;
     81    mnuViewInformation: TMenuItem;
     82    mnuViewDemo: TMenuItem;
     83    mnuViewVisits: TMenuItem;
     84    mnuViewPrimaryCare: TMenuItem;
     85    mnuViewMyHealtheVet: TMenuItem;
     86    mnuInsurance: TMenuItem;
     87    mnuViewFlags: TMenuItem;
     88    mnuViewReminders: TMenuItem;
     89    mnuViewRemoteData: TMenuItem;
     90    mnuViewPostings: TMenuItem;
     91    mnuOptimizeFields: TMenuItem;
    8192    procedure mnuChartTabClick(Sender: TObject);
    8293    procedure lstProbPickClick(Sender: TObject);
     
    110121    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
    111122      Y: Integer);
     123    procedure ViewInfo(Sender: TObject);
     124    procedure mnuViewInformationClick(Sender: TObject);
     125    procedure mnuOptimizeFieldsClick(Sender: TObject);
     126    procedure HeaderControlSectionClick(HeaderControl: THeaderControl;
     127      Section: THeaderSection);
     128    procedure HeaderControlMouseUp(Sender: TObject; Button: TMouseButton;
     129      Shift: TShiftState; X, Y: Integer);
     130    procedure HeaderControlMouseDown(Sender: TObject; Button: TMouseButton;
     131      Shift: TShiftState; X, Y: Integer);
     132    function getTotalSectionsWidth : integer;
     133    procedure setSectionWidths;
     134    procedure sptHorzMoved(Sender: TObject);
    112135  private
    113136    FContextString: string;
     
    179202  GridColWidths: Array[0..15] of integer =(0, 5, -1, 9, 9, 0, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0);
    180203
     204  type
     205  arOrigSecWidths = array[0..15] of integer;
     206
    181207var
    182208  frmProblems: TfrmProblems;
     
    185211  gFontWidth: Integer;
    186212  gFixedWidth: Integer;
     213  origWidths: arOrigSecWidths;
    187214
    188215implementation
     
    544571                  exit;
    545572                end ;
     573              if ProbRec.CmtIsXHTML then
     574                begin
     575                  InfoBox(ProbRec.CmtNoEditReason, 'Unable to add new comment', MB_ICONWARNING or MB_OK);
     576                  exit;
     577                end ;
    546578              cmt := NewComment ;
    547579              if (StrToInt(Piece(cmt, U, 1)) > 0) and (Piece(cmt, U, 3) <> '') then
     
    882914  HeaderControl.Sections[AdjustCol].AutoSize := True;
    883915  HeaderControl.Sections[AdjustCol].Width := HeaderControl.Width - cxUsed;
     916  //mnuOptimizeFieldsClick(self);       //******** test making compression, proportional, or no spacing on resize
    884917end;
    885918
     
    15861619  end ;
    15871620  lstProbActsClick(Self) ;
     1621  mnuOptimizeFieldsClick(self);
    15881622end;
    15891623
     
    17281762  if Assigned(dlgProbs) then
    17291763    dlgProbs.SetFontSize( MainFontSize);
     1764  mnuOptimizeFieldsClick(self);
    17301765end;
    17311766
     
    18101845  inherited;
    18111846  wgProbData.Invalidate;
     1847  {FEvtColWidth := HeaderControl.Sections[0].Width;     //code from fOrders
     1848  RedrawSuspend(Self.Handle);
     1849  //RedrawOrderList;
     1850  RedrawActivate(Self.Handle);
     1851  wgProbData.Invalidate;
     1852  pnlRight.Refresh;
     1853  pnlLeft.Refresh; }
    18121854end;
    18131855
     
    19291971end;
    19301972
     1973procedure TfrmProblems.ViewInfo(Sender: TObject);
     1974begin
     1975  inherited;
     1976  frmFrame.ViewInfo(Sender);
     1977end;
     1978
     1979procedure TfrmProblems.mnuViewInformationClick(Sender: TObject);
     1980begin
     1981  inherited;
     1982  mnuViewDemo.Enabled := frmFrame.pnlPatient.Enabled;
     1983  mnuViewVisits.Enabled := frmFrame.pnlVisit.Enabled;
     1984  mnuViewPrimaryCare.Enabled := frmFrame.pnlPrimaryCare.Enabled;
     1985  mnuViewMyHealtheVet.Enabled := not (Copy(frmFrame.laMHV.Hint, 1, 2) = 'No');
     1986  mnuInsurance.Enabled := not (Copy(frmFrame.laVAA2.Hint, 1, 2) = 'No');
     1987  mnuViewFlags.Enabled := frmFrame.lblFlag.Enabled;
     1988  mnuViewRemoteData.Enabled := frmFrame.lblCirn.Enabled;
     1989  mnuViewReminders.Enabled := frmFrame.pnlReminders.Enabled;
     1990  mnuViewPostings.Enabled := frmFrame.pnlPostings.Enabled;
     1991end;
     1992
     1993procedure TfrmProblems.mnuOptimizeFieldsClick(Sender: TObject);
     1994var
     1995  totalSectionsWidth, unitvalue: integer;
     1996begin
     1997  totalSectionsWidth := pnlRight.Width - 3;
     1998  if totalSectionsWidth < 16 then exit;
     1999  unitvalue := round(totalSectionsWidth / 16);
     2000  with HeaderControl do
     2001  begin
     2002    if Sections[1].Width > 0 then Sections[1].Width := unitvalue;
     2003    Sections[2].Width := pnlRight.Width - (unitvalue * 11) - 5;
     2004    Sections[3].Width := unitvalue * 2;
     2005    Sections[4].Width := unitvalue * 2;
     2006    if Sections[6].Width > 0 then Sections[6].Width := unitvalue;
     2007    if Sections[7].Width > 0 then Sections[7].Width := unitvalue * 2;
     2008    if Sections[8].Width > 0 then Sections[8].Width := unitvalue * 2;
     2009    if Sections[15].Width > 0 then Sections[15].Width := unitvalue;
     2010  end;
     2011  HeaderControlSectionResize(HeaderControl, HeaderControl.Sections[0]);
     2012  HeaderControl.Repaint;
     2013end;
     2014
     2015procedure TfrmProblems.HeaderControlSectionClick(
     2016  HeaderControl: THeaderControl; Section: THeaderSection);
     2017begin
     2018  inherited;
     2019  //if Section = HeaderControl.Sections[1] then
     2020    mnuOptimizeFieldsClick(self);
     2021end;
     2022
     2023procedure TfrmProblems.HeaderControlMouseUp(Sender: TObject;
     2024  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
     2025var
     2026  i: integer;
     2027  totalSectionsWidth, originalwidth: integer;
     2028begin
     2029  inherited;
     2030  totalSectionsWidth := getTotalSectionsWidth;
     2031  if totalSectionsWidth > wgProbData.Width - 5 then
     2032  begin
     2033    originalwidth := 0;
     2034    for i := 0 to HeaderControl.Sections.Count - 1 do
     2035      originalwidth := originalwidth + origWidths[i];
     2036    if originalwidth < totalSectionsWidth then
     2037    begin
     2038      for i := 0 to HeaderControl.Sections.Count - 1 do
     2039        HeaderControl.Sections[i].Width := origWidths[i];
     2040      wgProbData.Invalidate;
     2041    end;
     2042  end;
     2043end;
     2044
     2045function TfrmProblems.getTotalSectionsWidth : integer;
     2046var
     2047  i: integer;
     2048begin
     2049  Result := 0;
     2050  for i := 0 to HeaderControl.Sections.Count - 1 do
     2051     Result := Result + HeaderControl.Sections[i].Width;
     2052end;
     2053
     2054procedure TfrmProblems.HeaderControlMouseDown(Sender: TObject;
     2055  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
     2056begin
     2057  inherited;
     2058  setSectionWidths;
     2059end;
     2060
     2061procedure TfrmProblems.setSectionWidths;
     2062var
     2063  i: integer;
     2064begin
     2065  for i := 0 to 15 do
     2066     origWidths[i] := HeaderControl.Sections[i].Width;
     2067end;
     2068
     2069procedure TfrmProblems.sptHorzMoved(Sender: TObject);
     2070begin
     2071  inherited;
     2072  mnuOptimizeFieldsClick(self);
     2073end;
     2074
    19312075end.
    19322076
Note: See TracChangeset for help on using the changeset viewer.