LCL-CustomDrawn: Re-enables support for SetFocus in all platforms except Android and adds SetFocus support in the Accessibility code, this changes the focus when the selection is changed with VoiceOver

git-svn-id: trunk@38246 -
This commit is contained in:
sekelsenmat 2012-08-15 09:01:38 +00:00
parent 78e73fc658
commit a2c19ec20c
2 changed files with 44 additions and 3 deletions

View File

@ -1499,11 +1499,50 @@ begin
DebugLn('[TCocoaAccessibleObject.accessibilityIsAttributeSettable]');
{$endif}
Result := False;
//
// Value - The elements value. May be settable.
//
if attribute.isEqualToString(NSAccessibilityValueAttribute) then
begin
if LCLAcc.AccessibleRole in [larComboBox, larTextEditorMultiline, larTextEditorSingleline] then
begin
Result := True;
end;
end
//
// Always Settable attributes
//
else if attribute.isEqualToString(NSAccessibilityFocusedAttribute) or
attribute.isEqualToString(NSAccessibilitySelectedTextAttribute) or
attribute.isEqualToString(NSAccessibilitySelectedTextRangeAttribute) or
attribute.isEqualToString(NSAccessibilityVisibleCharacterRangeAttribute) then
begin
Result := True;
end;
end;
procedure TCocoaAccessibleObject.accessibilitySetValue_forAttribute(value: id;
attribute: NSString);
begin
{$ifdef VerboseCDAccessibility}
DebugLn(':>[TCocoaAccessibleObject.accessibilitySetValue_forAttribute]');
{$endif}
if attribute.isEqualToString(NSAccessibilityFocusedAttribute) then
begin
{$ifdef VerboseCDAccessibility}
DebugLn(':<[TCocoaAccessibleObject.accessibilitySetValue_forAttribute] Control=%s:%s Value=%d',
[LCLControl.Name, LCLControl.ClassName, NSNumber(value).intValue()]);
{$endif}
if not (LCLControl is TWinControl) then Exit;
if not NSNumber(value).boolValue() then Exit;
if LCLInjectedControl <> nil then LCLInjectedControl.SetFocus()
else TWinControl(LCLControl).SetFocus();
end
else if attribute.isEqualToString(NSAccessibilityValueAttribute) then
begin
LCLControl.Caption := NSStringToString(value);
end;
end;
function TCocoaAccessibleObject.accessibilityParameterizedAttributeNames: NSArray;

View File

@ -5463,8 +5463,9 @@ begin
{$endif}
Result := 0;
// Strangly this breaks the Android Virtual Keyboard =(
// Uncomment only when we can guarantee that this doesn't break Android Virtual Keyboard
(* if hwnd = 0 then
// Remove the ifdef only when we can guarantee that this doesn't break Android Virtual Keyboard
{$ifndef CD_Android}
if hwnd = 0 then
begin
Result := GetFocus();
Exit;
@ -5490,7 +5491,8 @@ begin
else
begin
Result := BackendSetFocus(hWnd);
end;*)
end;
{$endif}
end;
(*function TQtWidgetSet.GetForegroundWindow: HWND;