Fixes a bug in the code to iterate accessible objects, it didnt work, now it does

git-svn-id: trunk@37159 -
This commit is contained in:
sekelsenmat 2012-05-05 09:58:28 +00:00
parent 5b94ac9513
commit f0f5beb5cf
2 changed files with 12 additions and 4 deletions

View File

@ -275,7 +275,8 @@ begin
begin
FLastSearchIndex := 1;
FLastSearchInSubcontrols := True;
Result := TWinControl(OwnerControl).Controls[0].GetAccessibleObject();
if (TWinControl(OwnerControl).ControlCount > 0) then
Result := TWinControl(OwnerControl).Controls[0].GetAccessibleObject();
end;
end;
@ -295,7 +296,7 @@ begin
end
else
begin
if TWinControl(OwnerControl).ControlCount < FLastSearchIndex then
if TWinControl(OwnerControl).ControlCount > FLastSearchIndex then
begin
Result := TWinControl(OwnerControl).Controls[FLastSearchIndex].GetAccessibleObject();
Inc(FLastSearchIndex);

View File

@ -710,8 +710,10 @@ var
begin
Result := inherited accessibilityAttributeValue(attribute);
{$ifdef VerboseCDAccessibility}
//lStrAttr := NSStringToString(attribute);
//DebugLn('[TCocoaCustomControl.accessibilityAttributeValue] attribute='+lStrAttr);
{$endif}
if attribute.isEqualToString(NSAccessibilityChildrenAttribute) then
begin
@ -958,7 +960,7 @@ begin
lStrAttr := '[TCocoaCustomControl.accessibilityAttributeValue] NSAccessibilityChildrenAttribute';
{$endif}
lAResult := NSArray(Result);
lMAResult := lAResult.mutableCopy();
lMAResult := NSMutableArray.arrayWithCapacity(0); //lAResult.mutableCopy();
lForm := WindowHandle.LCLForm;
lFormAcc := lForm.GetAccessibleObject();
lChildAcc := lFormAcc.GetFirstChildAccessibleObject();
@ -1090,7 +1092,12 @@ begin
{$endif}
// if the parent is a form, pass to the custom control
if lParent is TCustomForm then
Result := TCocoaWindow(lParent.Handle).ClientArea
begin
Result := TCocoaWindow(lParent.Handle).ClientArea;
{$ifdef VerboseCDAccessibility}
DebugLn(':[TCocoaAccessibleObject.accessibilityAttributeValue] Parent is TCustomForm, so redirecting to ClientArea');
{$endif}
end
else
Result := TCocoaAccessibleObject(lParent.GetAccessibleObject().Handle);
end