Ignore:
Timestamp:
Jul 7, 2010, 4:31:10 PM (14 years ago)
Author:
Kevin Toppenberg
Message:

Upgrade to version 27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/Templates/fTemplateDialog.pas

    r456 r829  
    55uses
    66  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;
    89
    910type
    10   TfrmTemplateDialog = class(TForm)
     11  TfrmTemplateDialog = class(TfrmBase508Form)
    1112    sbMain: TScrollBox;
    1213    pnlBottom: TScrollBox;
     
    2627    procedure btnPreviewClick(Sender: TObject);
    2728    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     29    procedure FormShow(Sender: TObject);
    2830  private
     31    FFirstBuild: boolean;
    2932    SL: TStrings;
    3033    BuildIdx: TStringList;
     
    5760    procedure ParentCBEnter(Sender: TObject);
    5861    procedure ParentCBExit(Sender: TObject);
     62    procedure UMScreenReaderInit(var Message: TMessage); message UM_MISC;
     63    procedure InitScreenReaderSetup;
    5964  public
    6065    property Silent: boolean read FSilent write FSilent ;
     
    7277implementation
    7378
    74 uses dShared, uConst, uTemplateFields, fRptBox, uInit, rMisc;
     79uses dShared, uTemplateFields, fRptBox, uInit, rMisc, uDlgComponents,
     80  VA508AccessibilityRouter, VAUtils;
    7581
    7682{$R *.DFM}
     
    187193  Result := FALSE;
    188194  CancelDlg := FALSE;
     195  SetTemplateDialogCanceled(FALSE);
    189196  frmTemplateDialog := TfrmTemplateDialog.Create(Application);
    190197  try
     
    272279  end;
    273280
    274   if not Result then
     281  if Result then
     282    SetTemplateDialogCanceled(TRUE)
     283  else
     284  begin
     285    SetTemplateDialogCanceled(FALSE);
    275286    CheckBoilerplate4Fields(SL, CaptionText, PreviewMode);
    276 
     287  end;
     288 
    277289end;
    278290
     
    289301      SL.Clear;
    290302  end;
     303  StripScreenReaderCodes(SL);
    291304end;
    292305
     
    380393end;
    381394
     395procedure TfrmTemplateDialog.InitScreenReaderSetup;
     396var
     397  ctrl: TWinControl;
     398  list: TList;
     399begin
     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;
     414end;
     415
    382416function TfrmTemplateDialog.IsAncestor( OldID: string; NewID: string): boolean;
    383417begin
     
    398432  KillCtrl, doHint, dsp, noTextParent: boolean;
    399433  Entry: TTemplateDialogEntry;
    400   StringIn, StringOut: string;
     434//  StringIn, StringOut: string;
     435  cb: TCPRSDialogParentCheckBox;
    401436
    402437  procedure NextTabCtrl(ACtrl: TControl);
     
    511546      Entry := TTemplateDialogEntry(Entries.Objects[idx]);
    512547
    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);
    514554    pnl.Show;
    515555    if(doHint and (not pnl.ShowHint)) then
     
    521561      Entry.OnChange := FieldChanged;
    522562    end;
    523     if(dsp or OneOnly) then
     563    if not assigned(cb) then
    524564      ctrl := pnl
    525565    else
    526566    begin
    527       ctrl := TORCheckBox.Create(Self);
     567      ctrl := cb;
    528568      ctrl.Parent := sbMain;
    529569
     
    539579      TORCheckBox(ctrl).AutoSize := false;
    540580      TORCheckBox(ctrl).Associate := pnl;
     581      pnl.Tag := Integer(ctrl);
    541582      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);
    548590
    549591    end;
     
    615657    for i := 1 to Count do
    616658      BuildCB(i, Y, FirstTime);
     659    if ScreenReaderSystemActive then
     660    begin
     661      amgrMain.RefreshComponents;
     662      Application.ProcessMessages;
     663    end;
    617664  finally
    618665    FBuilding := FALSE;
     
    626673    RepaintBuild := FALSE;
    627674    BuildAllControls;
     675    InitScreenReaderSetup;
     676  end;
     677end;
     678
     679procedure TfrmTemplateDialog.FormShow(Sender: TObject);
     680begin
     681  inherited;
     682  if FFirstBuild then
     683  begin
     684    FFirstBuild := FALSE;
     685    InitScreenReaderSetup;
    628686  end;
    629687end;
     
    631689procedure TfrmTemplateDialog.FormCreate(Sender: TObject);
    632690begin
     691  FFirstBuild := TRUE;
    633692  BuildIdx := TStringList.Create;
    634693  Entries := TStringList.Create;
     
    700759      if not CanClose then
    701760      begin
    702         ShowMessage(MissingFieldsTxt);
     761        ShowMsg(MissingFieldsTxt);
    703762        break;
    704763      end;
     
    719778  TmpSL := TStringList.Create;
    720779  try
    721     TmpSL.Assign(SL);
     780    FastAssign(SL, TmpSL);
    722781    GetText(TmpSL, FALSE);  {FALSE = Do not include embedded fields}
     782    StripScreenReaderCodes(TmpSL);
    723783    ReportBox(TmpSL, 'Dialog Preview', FALSE);
    724784  finally
     
    755815end;
    756816
     817procedure TfrmTemplateDialog.UMScreenReaderInit(var Message: TMessage);
     818var
     819  ctrl: TWinControl;
     820  item: TVA508AccessibilityItem;
     821begin
     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;
     832end;
     833
    757834end.
    758835
Note: See TracChangeset for help on using the changeset viewer.