diff --git a/lcl/interfaces/customdrawn/customdrawn_cocoaproc.pas b/lcl/interfaces/customdrawn/customdrawn_cocoaproc.pas index cb13b59a8a..05d4766296 100644 --- a/lcl/interfaces/customdrawn/customdrawn_cocoaproc.pas +++ b/lcl/interfaces/customdrawn/customdrawn_cocoaproc.pas @@ -1499,11 +1499,50 @@ begin DebugLn('[TCocoaAccessibleObject.accessibilityIsAttributeSettable]'); {$endif} Result := False; + + // + // Value - The element’s 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; diff --git a/lcl/interfaces/customdrawn/customdrawnwinapi.inc b/lcl/interfaces/customdrawn/customdrawnwinapi.inc index 72328882a5..36bb0dcf6a 100644 --- a/lcl/interfaces/customdrawn/customdrawnwinapi.inc +++ b/lcl/interfaces/customdrawn/customdrawnwinapi.inc @@ -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;