Changeset 460 for cprs/branches/foia-cprs/CPRS-Chart/Orders/fOCSession.pas
- Timestamp:
- Jul 6, 2008, 8:20:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/foia-cprs/CPRS-Chart/Orders/fOCSession.pas
r459 r460 5 5 uses 6 6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 7 fAutoSz, StdCtrls, ORFn, uConst, ORCtrls ;7 fAutoSz, StdCtrls, ORFn, uConst, ORCtrls, ExtCtrls; 8 8 9 9 type 10 10 TfrmOCSession = class(TfrmAutoSz) 11 lstChecks: TListBox; 11 lstChecks: TCaptionListBox; 12 pnlBottom: TPanel; 13 lblJustify: TLabel; 12 14 txtJustify: TCaptionEdit; 13 lblJustify: TLabel;14 15 cmdCancelOrder: TButton; 15 16 cmdContinue: TButton; … … 20 21 procedure lstChecksDrawItem(Control: TWinControl; Index: Integer; 21 22 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); 22 28 private 23 29 FCritical: Boolean; … … 36 42 {$R *.DFM} 37 43 38 uses rOrders, uCore ;44 uses rOrders, uCore, rMisc; 39 45 40 46 type … … 49 55 var 50 56 uCheckedOrders: TList; 57 FOldHintHidePause: integer; 51 58 52 59 constructor TOCRec.Create(const AnID: string); … … 54 61 OrderID := AnID; 55 62 Checks := TStringList.Create; 63 FOldHintHidePause := Application.HintHidePause; 56 64 end; 57 65 58 66 destructor TOCRec.Destroy; 59 67 begin 68 Application.HintHidePause := FOldHintHidePause; 60 69 Checks.Free; 61 70 inherited Destroy; … … 141 150 frmOCSession.SetReqJustify; 142 151 MessageBeep(MB_ICONASTERISK); 152 if frmOCSession.Visible then frmOCSession.SetFocus; 143 153 frmOCSession.ShowModal; 144 154 finally … … 166 176 lblJustify.Visible := FCritical; 167 177 txtJustify.Visible := FCritical; 168 end; 169 170 procedure TfrmOCSession.lstChecksMeasureItem(Control: TWinControl; Index: Integer; 171 178 179 end; 180 181 procedure TfrmOCSession.lstChecksMeasureItem(Control: TWinControl; Index: Integer; var Height: Integer); 172 182 var 173 183 i, AHt, TotalHt: Integer; … … 177 187 begin 178 188 inherited; 189 179 190 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; 198 208 Height := TotalHt + 2; // add 2 for focus rectangle 199 end; 200 201 procedure TfrmOCSession.lstChecksDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; 202 209 if Height > 255 then Height := 255; //CQ7178 210 end; 211 212 procedure TfrmOCSession.lstChecksDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); 203 213 var 204 214 i, AHt: Integer; … … 208 218 begin 209 219 inherited; 220 210 221 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 226 230 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 238 247 end; 239 248 … … 268 277 if FCritical and ((Length(txtJustify.Text) < 2) or not ContainsVisibleChar(txtJustify.Text)) then 269 278 begin 270 InfoBox('A justification for overriding critical order checks is required.',279 InfoBox('A justification for overriding critical order checks is required.', 271 280 'Justification Required', MB_OK); 272 281 Exit; … … 278 287 end; 279 288 289 procedure TfrmOCSession.FormClose(Sender: TObject; 290 var Action: TCloseAction); 291 begin 292 inherited; 293 SaveUserBounds(Self); //Save Position & Size of Form 294 end; 295 296 procedure TfrmOCSession.FormShow(Sender: TObject); 297 begin 298 inherited; 299 SetFormPosition(Self); //Get Saved Position & Size of Form 300 end; 301 302 303 procedure TfrmOCSession.FormResize(Sender: TObject); 304 begin 305 //TfrmAutoSz has defect must call inherited Resize for the resize to function. 306 inherited; 307 end; 308 309 procedure TfrmOCSession.txtJustifyKeyDown(Sender: TObject; var Key: Word; 310 Shift: TShiftState); 311 begin 312 inherited; 313 //GE CQ9540 activate Return key, behave as "Continue" buttom clicked. 314 if Key = VK_RETURN then cmdContinueClick(self); 315 end; 316 280 317 end.
Note:
See TracChangeset
for help on using the changeset viewer.