Jump to content
Feniks888

How to Set contentDescription for TImage Component in Delphi FMX for Google Accessibility?

Recommended Posts

Hello everyone,

I'm currently working on a Delphi FMX application and need to improve its accessibility features for interactive elements. Specifically, I want to set the contentDescription for a TImage component, so that it can be properly identified by Google accessibility programs, allowing visually impaired users to interact with it effectively.

Could someone please guide me on how to set the contentDescription for an existing TImage component on my form? Any examples or best practices for implementing accessibility in Delphi FMX would be greatly appreciated!

Thank you in advance for your help!

Share this post


Link to post
3 hours ago, Lajos Juhász said:

Я вважаю, що це все ще така ситуація. 

 

Thank you for your response.

Share this post


Link to post

Maybe that can give some ideas, although for Win and VCL.
https://stackoverflow.com/questions/38273974/delphi-components-and-screen-readers

Perhaps this can be implemented in similar ways on Android too?  But I doubt it will be already well prepared under FMX, habe not checked recently.

 

Edit:

 

Maybe you can check, if this might work for you ( untested ) :
But I doubt that the Delphi handle works as expected.

 

uses
  System.SysUtils,
  FMX.Types,
  FMX.Controls,
  FMX.Platform,
  FMX.Platform.Android,
  Androidapi.JNI.GraphicsContentViewText, 
  Androidapi.Helpers, 
  Androidapi.JNI.Widget;
  
...  

procedure SetControlAccessibilityDescription(AControl: TControl; const ADescription: string);
var
  NativeView: JView;
begin
  NativeView := WindowHandleToPlatform(AControl.Handle).View;

  if NativeView <> nil then
  begin
    NativeView.setContentDescription(StringToJString(ADescription));
  end
  else
  begin
    raise Exception.Create('Das View-Objekt konnte nicht abgerufen werden.');
  end;
end;

...

// Application for Label
SetControlAccessibilityDescription(Label1, 'Das ist eine Beschriftung für den Namen');

...

// Application for Edit
SetControlAccessibilityDescription(Edit1, 'Bitte geben Sie Ihren Namen ein');


...

// Application for Checkbox
SetControlAccessibilityDescription(CheckBox1, 'Ich akzeptiere die Nutzungsbedingungen');

...

// Application for Switch
SetControlAccessibilityDescription(Switch1, 'Benachrichtigungen ein- oder ausschalten');

 

 

Edited by Rollo62

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×