[829] | 1 | unit VA508DelphiCompatibility;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | SysUtils, Classes, Controls, Windows, StdCtrls, CheckLst, ExtCtrls, Forms,
|
---|
| 7 | ValEdit, DBGrids, Calendar, ComCtrls, VA508AccessibilityManager;
|
---|
| 8 |
|
---|
| 9 | function GetCheckBoxComponentName(AllowGrayed: boolean): string;
|
---|
| 10 | function GetCheckBoxInstructionMessage(Checked: boolean): string;
|
---|
| 11 | function GetCheckBoxStateText(State: TCheckBoxState): String;
|
---|
| 12 |
|
---|
| 13 | procedure ListViewIndexQueryProc(Sender: TObject; ItemIndex: integer; var Text: string);
|
---|
| 14 |
|
---|
| 15 | type
|
---|
| 16 | TVA508StaticTextManager = class(TVA508ManagedComponentClass)
|
---|
| 17 | public
|
---|
| 18 | constructor Create; override;
|
---|
| 19 | function GetComponentName(Component: TWinControl): string; override;
|
---|
| 20 | function GetCaption(Component: TWinControl): string; override;
|
---|
| 21 | function GetValue(Component: TWinControl): string; override;
|
---|
| 22 | end;
|
---|
| 23 |
|
---|
| 24 | implementation
|
---|
| 25 |
|
---|
| 26 | uses Grids, VA508AccessibilityRouter, VA508AccessibilityConst, VA508MSAASupport,
|
---|
| 27 | VAUtils;
|
---|
| 28 |
|
---|
| 29 | type
|
---|
| 30 | TCheckBox508Manager = class(TVA508ManagedComponentClass)
|
---|
| 31 | public
|
---|
| 32 | constructor Create; override;
|
---|
| 33 | function GetComponentName(Component: TWinControl): string; override;
|
---|
| 34 | function GetInstructions(Component: TWinControl): string; override;
|
---|
| 35 | function GetState(Component: TWinControl): string; override;
|
---|
| 36 | end;
|
---|
| 37 |
|
---|
| 38 | TCheckListBox508Manager = class(TVA508ManagedComponentClass)
|
---|
| 39 | private
|
---|
| 40 | function GetIndex(Component: TWinControl): integer;
|
---|
| 41 | public
|
---|
| 42 | constructor Create; override;
|
---|
| 43 | function GetComponentName(Component: TWinControl): string; override;
|
---|
| 44 | function GetState(Component: TWinControl): string; override;
|
---|
| 45 | function GetItem(Component: TWinControl): TObject; override;
|
---|
| 46 | function GetItemInstructions(Component: TWinControl): string; override;
|
---|
| 47 | end;
|
---|
| 48 |
|
---|
| 49 | TVA508EditManager = class(TVA508ManagedComponentClass)
|
---|
| 50 | public
|
---|
| 51 | constructor Create; override;
|
---|
| 52 | function GetValue(Component: TWinControl): string; override;
|
---|
| 53 | end;
|
---|
| 54 |
|
---|
| 55 | TVA508ComboManager = class(TVA508ManagedComponentClass)
|
---|
| 56 | public
|
---|
| 57 | constructor Create; override;
|
---|
| 58 | function GetValue(Component: TWinControl): string; override;
|
---|
| 59 | end;
|
---|
| 60 |
|
---|
| 61 | TCustomGrid508Manager = class(TVA508ManagedComponentClass)
|
---|
| 62 | private
|
---|
| 63 | public
|
---|
| 64 | constructor Create; override;
|
---|
| 65 | function GetComponentName(Component: TWinControl): string; override;
|
---|
| 66 | function GetInstructions(Component: TWinControl): string; override;
|
---|
| 67 | function GetValue(Component: TWinControl): string; override;
|
---|
| 68 | function GetItem(Component: TWinControl): TObject; override;
|
---|
| 69 | // function GetData(Component: TWinControl; Value: string): string; override;
|
---|
| 70 | end;
|
---|
| 71 |
|
---|
| 72 | TVA508RegistrationScreenReader = class(TVA508ScreenReader);
|
---|
| 73 |
|
---|
| 74 | function CustomComboAlternateHandle(Component: TWinControl): HWnd; forward;
|
---|
| 75 |
|
---|
| 76 | procedure ListViewIndexQueryProc(Sender: TObject; ItemIndex: integer; var Text: string);
|
---|
| 77 | var
|
---|
| 78 | temp: string;
|
---|
| 79 | view: TListView;
|
---|
| 80 | item: TListItem;
|
---|
| 81 | i: integer;
|
---|
| 82 | include: boolean;
|
---|
| 83 |
|
---|
| 84 | procedure Append(txt: string);
|
---|
| 85 | begin
|
---|
| 86 | if txt = '' then exit;
|
---|
| 87 | if text <> '' then
|
---|
| 88 | text := text + ' ';
|
---|
| 89 | text := text + txt + ',';
|
---|
| 90 | end;
|
---|
| 91 |
|
---|
| 92 | procedure AppendHeader(txt: string);
|
---|
| 93 | begin
|
---|
| 94 | if txt = '' then
|
---|
| 95 | txt := 'blank header';
|
---|
| 96 | Append(txt);
|
---|
| 97 | end;
|
---|
| 98 |
|
---|
| 99 | begin
|
---|
| 100 | view := TListView(Sender);
|
---|
| 101 | Text := '';
|
---|
| 102 | include := TRUE;
|
---|
| 103 | if (ItemIndex < 0) or (ItemIndex >= view.Items.Count) then exit;
|
---|
| 104 | item := view.Items.Item[ItemIndex];
|
---|
| 105 | if (view.ViewStyle = vsReport) and (view.Columns.Count > 0) then
|
---|
| 106 | begin
|
---|
| 107 | if view.Columns[0].Width < 1 then
|
---|
| 108 | include := FALSE
|
---|
| 109 | else
|
---|
| 110 | AppendHeader(view.Columns[0].Caption);
|
---|
| 111 | end;
|
---|
| 112 | if include then
|
---|
| 113 | begin
|
---|
| 114 | temp := item.Caption;
|
---|
| 115 | if temp = '' then
|
---|
| 116 | temp := 'blank';
|
---|
| 117 | Append(temp);
|
---|
| 118 | end;
|
---|
| 119 |
|
---|
| 120 | if view.ViewStyle = vsReport then
|
---|
| 121 | begin
|
---|
| 122 | for i := 1 to view.Columns.Count - 1 do
|
---|
| 123 | begin
|
---|
| 124 | if view.Columns[i].Width > 0 then
|
---|
| 125 | begin
|
---|
| 126 | AppendHeader(view.Columns[i].Caption);
|
---|
| 127 | if (i-1) < item.SubItems.Count then
|
---|
| 128 | temp := item.SubItems[i-1]
|
---|
| 129 | else
|
---|
| 130 | temp := '';
|
---|
| 131 | if temp = '' then
|
---|
| 132 | temp := 'blank';
|
---|
| 133 | Append(temp);
|
---|
| 134 | end;
|
---|
| 135 | end;
|
---|
| 136 | end;
|
---|
| 137 | end;
|
---|
| 138 |
|
---|
| 139 | procedure RegisterStandardDelphiComponents;
|
---|
| 140 | begin
|
---|
| 141 | RegisterAlternateHandleComponent(TCustomCombo, CustomComboAlternateHandle);
|
---|
| 142 | RegisterManagedComponentClass(TCheckBox508Manager.Create);
|
---|
| 143 | RegisterManagedComponentClass(TCheckListBox508Manager.Create);
|
---|
| 144 | RegisterManagedComponentClass(TCustomGrid508Manager.Create);
|
---|
| 145 | RegisterManagedComponentClass(TVA508StaticTextManager.Create);
|
---|
| 146 | RegisterManagedComponentClass(TVA508EditManager.Create);
|
---|
| 147 | RegisterManagedComponentClass(TVA508ComboManager.Create);
|
---|
| 148 |
|
---|
| 149 | with TVA508RegistrationScreenReader(GetScreenReader) do
|
---|
| 150 | begin
|
---|
| 151 | // even though TListView is in Default.JCF, we add it here to clear out previous MSAA setting
|
---|
| 152 | RegisterCustomClassBehavior(TListView.ClassName, CLASS_BEHAVIOR_LIST_VIEW);
|
---|
| 153 | RegisterCustomClassBehavior(TVA508StaticText.ClassName, CLASS_BEHAVIOR_STATIC_TEXT);
|
---|
| 154 | end;
|
---|
| 155 |
|
---|
| 156 | RegisterMSAAQueryListClassProc(TListView, ListViewIndexQueryProc);
|
---|
| 157 |
|
---|
| 158 | { TODO -oJeremy Merrill -c508 :
|
---|
| 159 | Add these components as ones that need an alternate handle
|
---|
| 160 | TColorBox
|
---|
| 161 | TValueListEditor ?? - may be fixed because it's a TStringGrid
|
---|
| 162 | TCaptionStringGrid
|
---|
| 163 | TToolBar (not needed when the tool bar doesn't have focus)
|
---|
| 164 | TPageScroller
|
---|
| 165 |
|
---|
| 166 | add stuff for image processing
|
---|
| 167 | descendents of TCustomTabControl
|
---|
| 168 |
|
---|
| 169 |
|
---|
| 170 | }
|
---|
| 171 |
|
---|
| 172 | { TODO -oJeremy Merrill -c508 :Need to create a fix for the list box stuff here}
|
---|
| 173 | end;
|
---|
| 174 |
|
---|
| 175 | { TCustomCombo Alternate Handle }
|
---|
| 176 |
|
---|
| 177 | type
|
---|
| 178 | TExposedCustomCombo = class(TCustomCombo)
|
---|
| 179 | public
|
---|
| 180 | property EditHandle;
|
---|
| 181 | end;
|
---|
| 182 |
|
---|
| 183 | function CustomComboAlternateHandle(Component: TWinControl): HWnd;
|
---|
| 184 | begin
|
---|
| 185 | Result := TExposedCustomCombo(Component).EditHandle;
|
---|
| 186 | end;
|
---|
| 187 |
|
---|
| 188 | { Check Box Utils - used by multiple classes }
|
---|
| 189 |
|
---|
| 190 | function GetCheckBoxComponentName(AllowGrayed: boolean): string;
|
---|
| 191 | begin
|
---|
| 192 | if AllowGrayed then
|
---|
| 193 | Result := 'Three State Check Box'
|
---|
| 194 | else
|
---|
| 195 | Result := 'Check Box';
|
---|
| 196 | end;
|
---|
| 197 |
|
---|
| 198 | function GetCheckBoxInstructionMessage(Checked: boolean): string;
|
---|
| 199 | begin
|
---|
| 200 | if not Checked then // handles clear and gray entries
|
---|
| 201 | Result := 'to check press space bar'
|
---|
| 202 | else
|
---|
| 203 | Result := 'to clear check mark press space bar';
|
---|
| 204 | end;
|
---|
| 205 |
|
---|
| 206 | function GetCheckBoxStateText(State: TCheckBoxState): String;
|
---|
| 207 | begin
|
---|
| 208 | case State of
|
---|
| 209 | cbUnchecked: Result := 'not checked';
|
---|
| 210 | cbChecked: Result := 'checked';
|
---|
| 211 | cbGrayed: Result := 'Partially Checked';
|
---|
| 212 | else Result := '';
|
---|
| 213 | end;
|
---|
| 214 | end;
|
---|
| 215 | { TCheckBox508Manager }
|
---|
| 216 |
|
---|
| 217 | constructor TCheckBox508Manager.Create;
|
---|
| 218 | begin
|
---|
| 219 | inherited Create(TCheckBox, [mtComponentName, mtInstructions, mtState, mtStateChange]);
|
---|
| 220 | end;
|
---|
| 221 |
|
---|
| 222 | function TCheckBox508Manager.GetComponentName(Component: TWinControl): string;
|
---|
| 223 | begin
|
---|
| 224 | Result := GetCheckBoxComponentName(TCheckBox(Component).AllowGrayed);
|
---|
| 225 | end;
|
---|
| 226 |
|
---|
| 227 | function TCheckBox508Manager.GetInstructions(Component: TWinControl): string;
|
---|
| 228 | begin
|
---|
| 229 | Result := GetCheckBoxInstructionMessage(TCheckBox(Component).Checked);
|
---|
| 230 | end;
|
---|
| 231 |
|
---|
| 232 | function TCheckBox508Manager.GetState(Component: TWinControl): string;
|
---|
| 233 | begin
|
---|
| 234 | Result := GetCheckBoxStateText(TCheckBox(Component).State);
|
---|
| 235 | end;
|
---|
| 236 |
|
---|
| 237 | { TCheckListBox508Manager }
|
---|
| 238 |
|
---|
| 239 | constructor TCheckListBox508Manager.Create;
|
---|
| 240 | begin
|
---|
| 241 | inherited Create(TCheckListBox, [mtComponentName, mtState, mtStateChange, mtItemChange, mtItemInstructions]);
|
---|
| 242 | end;
|
---|
| 243 |
|
---|
| 244 | function TCheckListBox508Manager.GetComponentName(
|
---|
| 245 | Component: TWinControl): string;
|
---|
| 246 | var
|
---|
| 247 | lb : TCheckListBox;
|
---|
| 248 | begin
|
---|
| 249 | lb := TCheckListBox(Component);
|
---|
| 250 | if lb.AllowGrayed then
|
---|
| 251 | Result := 'Three State Check List Box'
|
---|
| 252 | else
|
---|
| 253 | Result := 'Check List Box';
|
---|
| 254 | end;
|
---|
| 255 |
|
---|
| 256 | function TCheckListBox508Manager.GetItemInstructions(
|
---|
| 257 | Component: TWinControl): string;
|
---|
| 258 | var
|
---|
| 259 | lb : TCheckListBox;
|
---|
| 260 | idx: integer;
|
---|
| 261 | begin
|
---|
| 262 | lb := TCheckListBox(Component);
|
---|
| 263 | idx := GetIndex(Component);
|
---|
| 264 | if (idx < 0) then
|
---|
| 265 | Result := ''
|
---|
| 266 | else
|
---|
| 267 | Result := GetCheckBoxInstructionMessage(lb.Checked[idx]);
|
---|
| 268 | end;
|
---|
| 269 |
|
---|
| 270 | function TCheckListBox508Manager.GetIndex(Component: TWinControl): integer;
|
---|
| 271 | var
|
---|
| 272 | lb : TCheckListBox;
|
---|
| 273 | begin
|
---|
| 274 | lb := TCheckListBox(Component);
|
---|
| 275 | if (lb.ItemIndex < 0) then
|
---|
| 276 | begin
|
---|
| 277 | if lb.Count > 0 then
|
---|
| 278 | Result := 0
|
---|
| 279 | else
|
---|
| 280 | Result := -1
|
---|
| 281 | end
|
---|
| 282 | else
|
---|
| 283 | Result := lb.ItemIndex;
|
---|
| 284 | end;
|
---|
| 285 |
|
---|
| 286 | function TCheckListBox508Manager.GetItem(Component: TWinControl): TObject;
|
---|
| 287 | var
|
---|
| 288 | lb : TCheckListBox;
|
---|
| 289 | begin
|
---|
| 290 | lb := TCheckListBox(Component);
|
---|
| 291 | Result := TObject((lb.items.Count * 10000) + (lb.ItemIndex + 2));
|
---|
| 292 | end;
|
---|
| 293 |
|
---|
| 294 | function TCheckListBox508Manager.GetState(Component: TWinControl): string;
|
---|
| 295 | var
|
---|
| 296 | lb : TCheckListBox;
|
---|
| 297 | idx: integer;
|
---|
| 298 | begin
|
---|
| 299 | lb := TCheckListBox(Component);
|
---|
| 300 | idx := GetIndex(Component);
|
---|
| 301 | if idx < 0 then
|
---|
| 302 | Result := ''
|
---|
| 303 | else
|
---|
| 304 | Result := GetCheckBoxStateText(lb.State[idx]);
|
---|
| 305 | end;
|
---|
| 306 |
|
---|
| 307 | { TCustomForm508Manager }
|
---|
| 308 |
|
---|
| 309 | type
|
---|
| 310 | TAccessGrid = class(TCustomGrid);
|
---|
| 311 |
|
---|
| 312 | constructor TCustomGrid508Manager.Create;
|
---|
| 313 | begin
|
---|
| 314 | { TODO : Add support for other string grid features - like state changes for editing or selecting cells }
|
---|
| 315 | // inherited Create(TStringGrid, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE);
|
---|
| 316 | inherited Create(TCustomGrid, [mtComponentName, mtInstructions, mtValue, mtItemChange], TRUE);
|
---|
| 317 | // FLastX := -1;
|
---|
| 318 | // FLastY := -1;
|
---|
| 319 | end;
|
---|
| 320 |
|
---|
| 321 | // Data pieces
|
---|
| 322 | // 1 = Column header, if any
|
---|
| 323 | // 2 = Column #
|
---|
| 324 | // 3 = number of columns
|
---|
| 325 | // 4 = Row header, if any
|
---|
| 326 | // 5 = Row #
|
---|
| 327 | // 6 = number of rows
|
---|
| 328 | // 7 = Cell #
|
---|
| 329 | // 8 = total # of cells
|
---|
| 330 | // 9 = cell contents
|
---|
| 331 |
|
---|
| 332 | const
|
---|
| 333 | DELIM = '^';
|
---|
| 334 |
|
---|
| 335 | function TCustomGrid508Manager.GetComponentName(Component: TWinControl): string;
|
---|
| 336 | begin
|
---|
| 337 | Result := ' grid ';
|
---|
| 338 | // don't use 'grid' - we're abandoning the special code in the JAWS scripts for
|
---|
| 339 | // grids - it's too messy, and based on the 'grid' component name
|
---|
| 340 | end;
|
---|
| 341 | {
|
---|
| 342 | function TCustomGrid508Manager.GetData(Component: TWinControl; Value: string): string;
|
---|
| 343 |
|
---|
| 344 | var
|
---|
| 345 | grid: TAccessGrid;
|
---|
| 346 | row, col: integer;
|
---|
| 347 | cnt, x, y, max, mult: integer;
|
---|
| 348 | txt: string;
|
---|
| 349 |
|
---|
| 350 | procedure Add(txt: integer); overload;
|
---|
| 351 | begin
|
---|
| 352 | Result := Result + inttostr(txt) + DELIM;
|
---|
| 353 | end;
|
---|
| 354 |
|
---|
| 355 | procedure Add(txt: string); overload;
|
---|
| 356 | begin
|
---|
| 357 | Result := Result + Piece(txt,DELIM,1) + DELIM;
|
---|
| 358 | end;
|
---|
| 359 |
|
---|
| 360 | begin
|
---|
| 361 | grid := TAccessGrid(Component);
|
---|
| 362 | row := grid.Row;
|
---|
| 363 | col := grid.Col;
|
---|
| 364 | if (row >= 0) and (col >= 0) then
|
---|
| 365 | begin
|
---|
| 366 | if grid.FixedRows > 0 then
|
---|
| 367 | Add(grid.GetEditText(col, 0))
|
---|
| 368 | else
|
---|
| 369 | Add('');
|
---|
| 370 | Add(col - grid.FixedCols + 1);
|
---|
| 371 | Add(grid.ColCount - grid.FixedCols);
|
---|
| 372 |
|
---|
| 373 | if grid.FixedCols > 0 then
|
---|
| 374 | Add(grid.GetEditText(0, row))
|
---|
| 375 | else
|
---|
| 376 | Add('');
|
---|
| 377 | Add(row - grid.FixedRows + 1);
|
---|
| 378 | Add(grid.RowCount - grid.FixedRows);
|
---|
| 379 |
|
---|
| 380 | x := grid.ColCount - grid.FixedCols;
|
---|
| 381 | y := grid.RowCount - grid.FixedRows;
|
---|
| 382 | max := x * y;
|
---|
| 383 | x := grid.Col - grid.FixedCols;
|
---|
| 384 | y := grid.Row - grid.FixedRows;
|
---|
| 385 | mult := grid.ColCount - grid.FixedCols;
|
---|
| 386 |
|
---|
| 387 | if (mult > 0) and
|
---|
| 388 | (x >= 0) and (x < grid.ColCount) and
|
---|
| 389 | (y >= 0) and (y < grid.RowCount) then
|
---|
| 390 | begin
|
---|
| 391 | cnt := (y * mult) + x + 1;
|
---|
| 392 | Add(cnt);
|
---|
| 393 | end
|
---|
| 394 | else
|
---|
| 395 | Add(0);
|
---|
| 396 | Add(max);
|
---|
| 397 |
|
---|
| 398 | if Value = '' then
|
---|
| 399 | txt := grid.GetEditText(col, row)
|
---|
| 400 | else
|
---|
| 401 | txt := Value;
|
---|
| 402 |
|
---|
| 403 | Add(txt);
|
---|
| 404 | delete(Result,length(Result),1); // remove trailing delimeter
|
---|
| 405 | end
|
---|
| 406 | else
|
---|
| 407 | Result := '';
|
---|
| 408 | end; }
|
---|
| 409 |
|
---|
| 410 | function TCustomGrid508Manager.GetInstructions(Component: TWinControl): string;
|
---|
| 411 | var
|
---|
| 412 | grid: TAccessGrid;
|
---|
| 413 | // cnt, x, y, max, mult: integer;
|
---|
| 414 | begin
|
---|
| 415 | Result := '';
|
---|
| 416 | grid := TAccessGrid(Component);
|
---|
| 417 | // x := grid.ColCount - grid.FixedCols;
|
---|
| 418 | // y := grid.RowCount - grid.FixedRows;
|
---|
| 419 | // max := x * y;
|
---|
| 420 | // x := grid.Col - grid.FixedCols;
|
---|
| 421 | // y := grid.Row - grid.FixedRows;
|
---|
| 422 | // mult := grid.ColCount - grid.FixedCols;
|
---|
| 423 | //
|
---|
| 424 | // if (mult > 0) and
|
---|
| 425 | // (x >= 0) and (x < grid.ColCount) and
|
---|
| 426 | // (y >= 0) and (y < grid.RowCount) then
|
---|
| 427 | // begin
|
---|
| 428 | // cnt := (y * mult) + x + 1;
|
---|
| 429 | // Result := IntToStr(cnt) + ' of ' + inttostr(max) + ', ';
|
---|
| 430 | // end;
|
---|
| 431 | Result := Result + 'To move to items use the arrow ';
|
---|
| 432 | if goTabs in grid.Options then
|
---|
| 433 | Result := Result + ' or tab ';
|
---|
| 434 | Result := Result + 'keys';
|
---|
| 435 | end;
|
---|
| 436 |
|
---|
| 437 | // if
|
---|
| 438 | // key
|
---|
| 439 | //end;
|
---|
| 440 | (*
|
---|
| 441 | listbox
|
---|
| 442 | column 120 row 430
|
---|
| 443 |
|
---|
| 444 | unavailable (text of cell?) read only
|
---|
| 445 |
|
---|
| 446 | 20 or 81
|
---|
| 447 |
|
---|
| 448 |
|
---|
| 449 |
|
---|
| 450 | listbox
|
---|
| 451 | column 3 of 10
|
---|
| 452 | row 6 of 10
|
---|
| 453 |
|
---|
| 454 | unavailable (text of cell?) read only
|
---|
| 455 |
|
---|
| 456 | 20 or 81
|
---|
| 457 |
|
---|
| 458 |
|
---|
| 459 |
|
---|
| 460 | with each navigation:
|
---|
| 461 |
|
---|
| 462 | column 3 of 10
|
---|
| 463 | row 6 of 10
|
---|
| 464 |
|
---|
| 465 | unavailable (text of cell?) read only
|
---|
| 466 | *)
|
---|
| 467 |
|
---|
| 468 |
|
---|
| 469 | function TCustomGrid508Manager.GetItem(Component: TWinControl): TObject;
|
---|
| 470 | var
|
---|
| 471 | grid: TAccessGrid;
|
---|
| 472 | row, col, maxRow: integer;
|
---|
| 473 | begin
|
---|
| 474 | grid := TAccessGrid(Component);
|
---|
| 475 | row := grid.Row + 2;
|
---|
| 476 | col := grid.Col + 2;
|
---|
| 477 | MaxRow := grid.RowCount + 3;
|
---|
| 478 | if MaxRow < 1000 then
|
---|
| 479 | MaxRow := 1000;
|
---|
| 480 | Result := TObject((row * maxRow) + col);
|
---|
| 481 | end;
|
---|
| 482 |
|
---|
| 483 | //function TCustomGrid508Manager.GetValue(Component: TWinControl): string;
|
---|
| 484 | //var
|
---|
| 485 | // grid: TAccessGrid;
|
---|
| 486 | //begin
|
---|
| 487 | // grid := TAccessGrid(Component);
|
---|
| 488 | // Result := Piece(grid.GetEditText(grid.Col, grid.Row), DELIM, 1);
|
---|
| 489 | //end;
|
---|
| 490 |
|
---|
| 491 |
|
---|
| 492 | function TCustomGrid508Manager.GetValue(Component: TWinControl): string;
|
---|
| 493 | var
|
---|
| 494 | grid: TAccessGrid;
|
---|
| 495 | row, col: integer;
|
---|
| 496 | colHdr, rowHdr, txt: string;
|
---|
| 497 |
|
---|
| 498 | begin
|
---|
| 499 | grid := TAccessGrid(Component);
|
---|
| 500 | row := grid.Row;
|
---|
| 501 | col := grid.Col;
|
---|
| 502 | if (row >= 0) and (col >= 0) then
|
---|
| 503 | begin
|
---|
| 504 | // if col <> FLastX then
|
---|
| 505 | // begin
|
---|
| 506 | if grid.FixedRows > 0 then
|
---|
| 507 | colHdr := Piece(grid.GetEditText(col, 0), DELIM, 1)
|
---|
| 508 | else
|
---|
| 509 | colHdr := '';
|
---|
| 510 | if colHdr = '' then
|
---|
| 511 | colHdr := inttostr(col+1-grid.FixedCols) + ' of ' + inttostr(grid.ColCount-grid.FixedCols);
|
---|
| 512 | colHdr := 'column ' + colhdr + ', ';
|
---|
| 513 | // end
|
---|
| 514 | // else
|
---|
| 515 | // colHdr := '';
|
---|
| 516 | // FLastX := col;
|
---|
| 517 |
|
---|
| 518 | // if row <> FLastY then
|
---|
| 519 | // begin
|
---|
| 520 | if grid.FixedCols > 0 then
|
---|
| 521 | rowHdr := Piece(grid.GetEditText(0, row), DELIM, 1)
|
---|
| 522 | else
|
---|
| 523 | rowHdr := '';
|
---|
| 524 | if rowHdr = '' then
|
---|
| 525 | rowHdr := inttostr(row+1-grid.FixedRows) + ' of ' + inttostr(grid.RowCount-grid.FixedRows);
|
---|
| 526 | rowHdr := 'row ' + rowhdr + ', ';
|
---|
| 527 | // end
|
---|
| 528 | // else
|
---|
| 529 | // rowHdr := '';
|
---|
| 530 | // FLastY := row;
|
---|
| 531 |
|
---|
| 532 | txt := Piece(grid.GetEditText(col, row), DELIM, 1);
|
---|
| 533 | if txt = '' then
|
---|
| 534 | txt := 'blank';
|
---|
| 535 | Result := colHdr + rowHdr + txt;
|
---|
| 536 | end
|
---|
| 537 | else
|
---|
| 538 | Result := ' ';
|
---|
| 539 | end;
|
---|
| 540 |
|
---|
| 541 |
|
---|
| 542 | { TVA508StaticTextManager }
|
---|
| 543 |
|
---|
| 544 | constructor TVA508StaticTextManager.Create;
|
---|
| 545 | begin
|
---|
| 546 | inherited Create(TVA508StaticText, [mtComponentName, mtCaption, mtValue], TRUE);
|
---|
| 547 | end;
|
---|
| 548 |
|
---|
| 549 | function TVA508StaticTextManager.GetCaption(Component: TWinControl): string;
|
---|
| 550 | begin
|
---|
| 551 | Result := ' ';
|
---|
| 552 | end;
|
---|
| 553 |
|
---|
| 554 | function TVA508StaticTextManager.GetComponentName(
|
---|
| 555 | Component: TWinControl): string;
|
---|
| 556 | begin
|
---|
| 557 | Result := 'label';
|
---|
| 558 | end;
|
---|
| 559 |
|
---|
| 560 | function TVA508StaticTextManager.GetValue(Component: TWinControl): string;
|
---|
| 561 | var
|
---|
| 562 | next: TVA508ChainedLabel;
|
---|
| 563 | comp: TVA508StaticText;
|
---|
| 564 | begin
|
---|
| 565 | comp := TVA508StaticText(Component);
|
---|
| 566 | Result := comp.Caption;
|
---|
| 567 | next := comp.NextLabel;
|
---|
| 568 | while assigned(next) do
|
---|
| 569 | begin
|
---|
| 570 | Result := Result + ' ' + next.Caption;
|
---|
| 571 | next := next.NextLabel;
|
---|
| 572 | end;
|
---|
| 573 | end;
|
---|
| 574 |
|
---|
| 575 | { TVA508EditManager }
|
---|
| 576 |
|
---|
| 577 | constructor TVA508EditManager.Create;
|
---|
| 578 | begin
|
---|
| 579 | inherited Create(TEdit, [mtValue], TRUE);
|
---|
| 580 | end;
|
---|
| 581 |
|
---|
| 582 | function TVA508EditManager.GetValue(Component: TWinControl): string;
|
---|
| 583 | begin
|
---|
| 584 | Result := TEdit(Component).Text;
|
---|
| 585 | end;
|
---|
| 586 |
|
---|
| 587 | { TVA508ComboManager }
|
---|
| 588 |
|
---|
| 589 | constructor TVA508ComboManager.Create;
|
---|
| 590 | begin
|
---|
| 591 | inherited Create(TComboBox, [mtValue], TRUE);
|
---|
| 592 | end;
|
---|
| 593 |
|
---|
| 594 | function TVA508ComboManager.GetValue(Component: TWinControl): string;
|
---|
| 595 | begin
|
---|
| 596 | Result := TComboBox(Component).Text;
|
---|
| 597 | end;
|
---|
| 598 |
|
---|
| 599 | initialization
|
---|
| 600 | RegisterStandardDelphiComponents;
|
---|
| 601 |
|
---|
| 602 | end.
|
---|