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/Orders/fOCSession.pas

    r459 r460  
    55uses
    66  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    7   fAutoSz, StdCtrls, ORFn, uConst, ORCtrls;
     7  fAutoSz, StdCtrls, ORFn, uConst, ORCtrls, ExtCtrls;
    88
    99type
    1010  TfrmOCSession = class(TfrmAutoSz)
    11     lstChecks: TListBox;
     11    lstChecks: TCaptionListBox;
     12    pnlBottom: TPanel;
     13    lblJustify: TLabel;
    1214    txtJustify: TCaptionEdit;
    13     lblJustify: TLabel;
    1415    cmdCancelOrder: TButton;
    1516    cmdContinue: TButton;
     
    2021    procedure lstChecksDrawItem(Control: TWinControl; Index: Integer;
    2122      Rect: TRect; State: TOwnerDrawState);
     23    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     24    procedure FormShow(Sender: TObject);
     25    procedure FormResize(Sender: TObject);
     26    procedure txtJustifyKeyDown(Sender: TObject; var Key: Word;
     27      Shift: TShiftState);
    2228  private
    2329    FCritical: Boolean;
     
    3642{$R *.DFM}
    3743
    38 uses rOrders, uCore;
     44uses rOrders, uCore, rMisc;
    3945
    4046type
     
    4955var
    5056  uCheckedOrders: TList;
     57  FOldHintHidePause: integer;
    5158
    5259constructor TOCRec.Create(const AnID: string);
     
    5461  OrderID := AnID;
    5562  Checks := TStringList.Create;
     63  FOldHintHidePause := Application.HintHidePause;
    5664end;
    5765
    5866destructor TOCRec.Destroy;
    5967begin
     68  Application.HintHidePause := FOldHintHidePause;
    6069  Checks.Free;
    6170  inherited Destroy;
     
    141150        frmOCSession.SetReqJustify;
    142151        MessageBeep(MB_ICONASTERISK);
     152        if frmOCSession.Visible then frmOCSession.SetFocus;
    143153        frmOCSession.ShowModal;
    144154      finally
     
    166176  lblJustify.Visible := FCritical;
    167177  txtJustify.Visible := FCritical;
    168 end;
    169 
    170 procedure TfrmOCSession.lstChecksMeasureItem(Control: TWinControl; Index: Integer;
    171   var Height: Integer);
     178
     179end;
     180
     181procedure TfrmOCSession.lstChecksMeasureItem(Control: TWinControl; Index: Integer; var Height: Integer);
    172182var
    173183  i, AHt, TotalHt: Integer;
     
    177187begin
    178188  inherited;
     189
    179190  with lstChecks do
    180   begin
    181     if Index >= uCheckedOrders.Count then Exit;
    182     OCRec := TOCRec(uCheckedOrders.Items[Index]);
    183     ARect := ItemRect(Index);
    184     ARect.Left := ARect.Left + 2;
    185     AHt := DrawText(Canvas.Handle, PChar(OCRec.OrderText), Length(OCRec.OrderText), ARect,
    186                     DT_CALCRECT or DT_LEFT or DT_NOPREFIX or DT_WORDBREAK) + 2;
    187     TotalHt := AHt;
    188     for i := 0 to OCRec.Checks.Count - 1 do
    189     begin
    190       ARect := ItemRect(Index);
    191       ARect.Left := ARect.Left + 10;
    192       x := Piece(OCRec.Checks[i], U, 3);
    193       AHt := DrawText(Canvas.Handle, PChar(x), Length(x), ARect,
    194                       DT_CALCRECT or DT_LEFT or DT_NOPREFIX or DT_WORDBREAK);
    195       TotalHt := TotalHt + AHt;
    196     end;
    197   end;
     191     begin
     192       if Index >= uCheckedOrders.Count then Exit;
     193       OCRec := TOCRec(uCheckedOrders.Items[Index]);
     194       ARect := ItemRect(Index);
     195       ARect.Left := ARect.Left + 2;
     196       AHt := DrawText(Canvas.Handle, PChar(OCRec.OrderText), Length(OCRec.OrderText), ARect, DT_CALCRECT or DT_LEFT or DT_NOPREFIX or DT_WORDBREAK or DT_EXTERNALLEADING) + 2; //CQ7178: added DT_EXTERNALLEADING
     197       TotalHt := AHt;
     198
     199       for i := 0 to OCRec.Checks.Count - 1 do
     200          begin
     201            ARect := ItemRect(Index);
     202            ARect.Left := ARect.Left + 10;
     203            x := Piece(OCRec.Checks[i], U, 3);
     204            AHt := DrawText(Canvas.Handle, PChar(x), Length(x), ARect, DT_CALCRECT or DT_LEFT or DT_NOPREFIX or DT_WORDBREAK or DT_EXTERNALLEADING); //CQ7178: added DT_EXTERNALLEADING
     205            TotalHt := TotalHt + AHt;
     206          end;
     207     end;
    198208  Height := TotalHt + 2; // add 2 for focus rectangle
    199 end;
    200 
    201 procedure TfrmOCSession.lstChecksDrawItem(Control: TWinControl; Index: Integer; Rect: TRect;
    202   State: TOwnerDrawState);
     209  if Height > 255 then Height := 255; //CQ7178
     210end;
     211
     212procedure TfrmOCSession.lstChecksDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
    203213var
    204214  i, AHt: Integer;
     
    208218begin
    209219  inherited;
     220
    210221  with lstChecks do
    211   begin
    212     if Index >= uCheckedOrders.Count then Exit;
    213     OCRec := TOCRec(uCheckedOrders.Items[Index]);
    214     ARect := ItemRect(Index);
    215     AHt := DrawText(Canvas.Handle, PChar(OCRec.OrderText), Length(OCRec.OrderText), ARect,
    216                     DT_LEFT or DT_NOPREFIX or DT_WORDBREAK) + 2;
    217     ARect.Left := ARect.Left + 10;
    218     ARect.Top  := ARect.Top + AHt;
    219     for i := 0 to OCRec.Checks.Count - 1 do
    220     begin
    221       x := Piece(OCRec.Checks[i], U, 3);
    222       if not (odSelected in State) then
    223       begin
    224         if (Piece(OCRec.Checks[i], U, 2) = '1')
    225           then
     222     begin
     223       if Index >= uCheckedOrders.Count then Exit;
     224       OCRec := TOCRec(uCheckedOrders.Items[Index]);
     225       ARect := ItemRect(Index);
     226       AHt := DrawText(Canvas.Handle, PChar(OCRec.OrderText), Length(OCRec.OrderText), ARect, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK or DT_EXTERNALLEADING) + 2; //CQ7178: added DT_EXTERNALLEADING
     227       ARect.Left := ARect.Left + 10;
     228       ARect.Top  := ARect.Top + AHt;
     229       for i := 0 to OCRec.Checks.Count - 1 do
    226230          begin
    227             if ColorToRGB(clWindowText) = ColorToRGB(clBlack) then
    228               Canvas.Font.Color := clBlue;
    229             Canvas.Font.Style := [fsUnderline];
    230           end
    231           else Canvas.Font.Color := clWindowText;
    232       end;
    233       AHt := DrawText(Canvas.Handle, PChar(x), Length(x), ARect,
    234                       DT_LEFT or DT_NOPREFIX or DT_WORDBREAK);
    235       ARect.Top  := ARect.Top + AHt;
    236     end;
    237   end;
     231            x := Piece(OCRec.Checks[i], U, 3);
     232            if not (odSelected in State) then
     233               begin
     234                 if (Piece(OCRec.Checks[i], U, 2) = '1') then
     235                   begin
     236                     if ColorToRGB(clWindowText) = ColorToRGB(clBlack) then
     237                       Canvas.Font.Color := clBlue;
     238                     Canvas.Font.Style := [fsUnderline];
     239                   end
     240                 else Canvas.Font.Color := clWindowText;
     241               end;
     242            AHt := DrawText(Canvas.Handle, PChar(x), Length(x), ARect, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK or DT_EXTERNALLEADING); //CQ7178: added DT_EXTERNALLEADING
     243            ARect.Top  := ARect.Top + AHt;
     244        end;
     245     end;
     246
    238247end;
    239248
     
    268277  if FCritical and ((Length(txtJustify.Text) < 2) or not ContainsVisibleChar(txtJustify.Text)) then
    269278  begin
    270     InfoBox('A justification for overriding critical order checks is required.',
     279     InfoBox('A justification for overriding critical order checks is required.',
    271280            'Justification Required', MB_OK);
    272281    Exit;
     
    278287end;
    279288
     289procedure TfrmOCSession.FormClose(Sender: TObject;
     290  var Action: TCloseAction);
     291begin
     292  inherited;
     293  SaveUserBounds(Self); //Save Position & Size of Form
     294end;
     295
     296procedure TfrmOCSession.FormShow(Sender: TObject);
     297begin
     298  inherited;
     299  SetFormPosition(Self); //Get Saved Position & Size of Form
     300end;
     301
     302
     303procedure TfrmOCSession.FormResize(Sender: TObject);
     304begin
     305  //TfrmAutoSz has defect must call inherited Resize for the resize to function.
     306  inherited;
     307end;
     308
     309procedure TfrmOCSession.txtJustifyKeyDown(Sender: TObject; var Key: Word;
     310  Shift: TShiftState);
     311begin
     312  inherited;
     313  //GE CQ9540  activate Return key, behave as "Continue" buttom clicked.
     314  if Key = VK_RETURN then cmdContinueClick(self);
     315end;
     316
    280317end.
Note: See TracChangeset for help on using the changeset viewer.