Changeset 829 for cprs/trunk/CPRS-Chart/Templates/fTemplateDialog.pas
- Timestamp:
- Jul 7, 2010, 4:31:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Templates/fTemplateDialog.pas
r456 r829 5 5 uses 6 6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 7 StdCtrls, ExtCtrls, ORCtrls, ORFn, AppEvnts, uTemplates; 7 StdCtrls, ExtCtrls, ORCtrls, ORFn, AppEvnts, uTemplates, fBase508Form, uConst, 8 VA508AccessibilityManager; 8 9 9 10 type 10 TfrmTemplateDialog = class(T Form)11 TfrmTemplateDialog = class(TfrmBase508Form) 11 12 sbMain: TScrollBox; 12 13 pnlBottom: TScrollBox; … … 26 27 procedure btnPreviewClick(Sender: TObject); 27 28 procedure FormClose(Sender: TObject; var Action: TCloseAction); 29 procedure FormShow(Sender: TObject); 28 30 private 31 FFirstBuild: boolean; 29 32 SL: TStrings; 30 33 BuildIdx: TStringList; … … 57 60 procedure ParentCBEnter(Sender: TObject); 58 61 procedure ParentCBExit(Sender: TObject); 62 procedure UMScreenReaderInit(var Message: TMessage); message UM_MISC; 63 procedure InitScreenReaderSetup; 59 64 public 60 65 property Silent: boolean read FSilent write FSilent ; … … 72 77 implementation 73 78 74 uses dShared, uConst, uTemplateFields, fRptBox, uInit, rMisc; 79 uses dShared, uTemplateFields, fRptBox, uInit, rMisc, uDlgComponents, 80 VA508AccessibilityRouter, VAUtils; 75 81 76 82 {$R *.DFM} … … 187 193 Result := FALSE; 188 194 CancelDlg := FALSE; 195 SetTemplateDialogCanceled(FALSE); 189 196 frmTemplateDialog := TfrmTemplateDialog.Create(Application); 190 197 try … … 272 279 end; 273 280 274 if not Result then 281 if Result then 282 SetTemplateDialogCanceled(TRUE) 283 else 284 begin 285 SetTemplateDialogCanceled(FALSE); 275 286 CheckBoilerplate4Fields(SL, CaptionText, PreviewMode); 276 287 end; 288 277 289 end; 278 290 … … 289 301 SL.Clear; 290 302 end; 303 StripScreenReaderCodes(SL); 291 304 end; 292 305 … … 380 393 end; 381 394 395 procedure TfrmTemplateDialog.InitScreenReaderSetup; 396 var 397 ctrl: TWinControl; 398 list: TList; 399 begin 400 if ScreenReaderSystemActive then 401 begin 402 list := TList.Create; 403 try 404 sbMain.GetTabOrderList(list); 405 if list.Count > 0 then 406 begin 407 ctrl := TWinControl(list[0]); 408 PostMessage(Handle, UM_MISC, WParam(ctrl), 0); 409 end; 410 finally 411 list.free; 412 end; 413 end; 414 end; 415 382 416 function TfrmTemplateDialog.IsAncestor( OldID: string; NewID: string): boolean; 383 417 begin … … 398 432 KillCtrl, doHint, dsp, noTextParent: boolean; 399 433 Entry: TTemplateDialogEntry; 400 StringIn, StringOut: string; 434 // StringIn, StringOut: string; 435 cb: TCPRSDialogParentCheckBox; 401 436 402 437 procedure NextTabCtrl(ACtrl: TControl); … … 511 546 Entry := TTemplateDialogEntry(Entries.Objects[idx]); 512 547 513 pnl := Entry.GetPanel(FMaxPnlWidth, sbMain); 548 if(dsp or OneOnly) then 549 cb := nil 550 else 551 cb := TCPRSDialogParentCheckBox.Create(Self); 552 553 pnl := Entry.GetPanel(FMaxPnlWidth, sbMain, cb); 514 554 pnl.Show; 515 555 if(doHint and (not pnl.ShowHint)) then … … 521 561 Entry.OnChange := FieldChanged; 522 562 end; 523 if (dsp or OneOnly) then563 if not assigned(cb) then 524 564 ctrl := pnl 525 565 else 526 566 begin 527 ctrl := TORCheckBox.Create(Self);567 ctrl := cb; 528 568 ctrl.Parent := sbMain; 529 569 … … 539 579 TORCheckBox(ctrl).AutoSize := false; 540 580 TORCheckBox(ctrl).Associate := pnl; 581 pnl.Tag := Integer(ctrl); 541 582 tmpID := copy(ID, 1, (pos('.', ID) - 1)); {copy the ID without the decimal place} 542 if Templates.IndexOf(tmpID) > -1 then 543 StringIn := 'Sub-Template: ' + TTemplate(Templates.Objects[Templates.IndexOf(tmpID)]).PrintName 544 else 545 StringIn := 'Sub-Template:'; 546 StringOut := StringReplace(StringIn, '&', '&&', [rfReplaceAll]); 547 TORCheckBox(ctrl).Caption := StringOut; 583 // if Templates.IndexOf(tmpID) > -1 then 584 // StringIn := 'Sub-Template: ' + TTemplate(Templates.Objects[Templates.IndexOf(tmpID)]).PrintName 585 // else 586 // StringIn := 'Sub-Template:'; 587 // StringOut := StringReplace(StringIn, '&', '&&', [rfReplaceAll]); 588 // TORCheckBox(ctrl).Caption := StringOut; 589 UpdateColorsFor508Compliance(ctrl); 548 590 549 591 end; … … 615 657 for i := 1 to Count do 616 658 BuildCB(i, Y, FirstTime); 659 if ScreenReaderSystemActive then 660 begin 661 amgrMain.RefreshComponents; 662 Application.ProcessMessages; 663 end; 617 664 finally 618 665 FBuilding := FALSE; … … 626 673 RepaintBuild := FALSE; 627 674 BuildAllControls; 675 InitScreenReaderSetup; 676 end; 677 end; 678 679 procedure TfrmTemplateDialog.FormShow(Sender: TObject); 680 begin 681 inherited; 682 if FFirstBuild then 683 begin 684 FFirstBuild := FALSE; 685 InitScreenReaderSetup; 628 686 end; 629 687 end; … … 631 689 procedure TfrmTemplateDialog.FormCreate(Sender: TObject); 632 690 begin 691 FFirstBuild := TRUE; 633 692 BuildIdx := TStringList.Create; 634 693 Entries := TStringList.Create; … … 700 759 if not CanClose then 701 760 begin 702 ShowM essage(MissingFieldsTxt);761 ShowMsg(MissingFieldsTxt); 703 762 break; 704 763 end; … … 719 778 TmpSL := TStringList.Create; 720 779 try 721 TmpSL.Assign(SL);780 FastAssign(SL, TmpSL); 722 781 GetText(TmpSL, FALSE); {FALSE = Do not include embedded fields} 782 StripScreenReaderCodes(TmpSL); 723 783 ReportBox(TmpSL, 'Dialog Preview', FALSE); 724 784 finally … … 755 815 end; 756 816 817 procedure TfrmTemplateDialog.UMScreenReaderInit(var Message: TMessage); 818 var 819 ctrl: TWinControl; 820 item: TVA508AccessibilityItem; 821 begin 822 ctrl := TWinControl(Message.WParam); 823 // Refresh the accessibility manager entry - 824 // fixes bug where first focusable check boxes weren't working correctly 825 if ctrl is TCPRSDialogParentCheckBox then 826 begin 827 item := amgrMain.AccessData.FindItem(ctrl, FALSE); 828 if assigned(item) then 829 item.free; 830 amgrMain.AccessData.EnsureItemExists(ctrl); 831 end; 832 end; 833 757 834 end. 758 835
Note:
See TracChangeset
for help on using the changeset viewer.