Jump to content
pquessev

Some questions about password input and TDialogService

Recommended Posts

Hello,

I developed an application that implements a password input feature, in which the user should be able to temporarily display the password.

I defined the input fields in a rectangle whose visibility I can control. I added a TPasswordEditButton to the TEdit field (on Android, I use a TEditButton and implement the MouseUp and MouseDown event processing). This approach works, but I was wondering if it was possible to achieve a similar result with TDialogServiceASync.

On Windows, the construction of the dialog elements is done in TDialogBuilder.InputQuery in FMX.DialogHelper. I modified this function to add a TPasswordEditButton component to the Edit field when the input is identified as a password. It works very well.

If I understand correctly, in Android, the dialog construction isn't done in this function but in FMXDialogHelpers.java. I'm not an Android Java expert, but I have a feeling there might be a way to modify this function to use a TextInputEditText field, which seems to have a feature to show/hide the password. However, I'm not sure how feasible this modification would be.

Do you have any ideas on this?

Share this post


Link to post

I can't answer your question.  But an alternative approach would be to create your own dialog however you want, and then write your own class that implements the IFMXDialogServiceAsync interface to show your dialog, and then register that class with FMX using TPlatformServices.Current.AddPlatformService() (be sure to unregister the default implementation using TPlatformServices.Current.RemovePlatformService() first).

Edited by Remy Lebeau
  • Like 1

Share this post


Link to post

Modifying standard units can be a source of problems when you install a new update or major release. It's better you add your own implementation.

 

 

In FMX it's simple :

- ShowModal of a form for Windows, Mac, Linux

- For iOS / Android, using a Rectangle for the background (to catch the click events) and your design in front of it. A TFrame shown with an alignment contains and it's done.

 

You can also use https://github.com/andrea-magni/TFrameStand which have dialog box samples.

Edited by Patrick PREMARTIN

Share this post


Link to post
7 hours ago, Patrick PREMARTIN said:

- ShowModal of a form for Windows, Mac, Linux

The OP asked about Android, and modal dialogs are not supported on Android. 

Share this post


Link to post
15 minutes ago, Remy Lebeau said:

The OP asked about Android, and modal dialogs are not supported on Android. 

It was my second point, I've updated the post.

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

×