aeric Expert Licensed User Longtime User Jan 15, 2025 #1 Using the code below, I can Center the alignment of text. B4X: Copy B4XFloatTextField.TextField.SetTextAlignment("CENTER", "CENTER") For Password Field, when I click the reveal (eye) button, the alignment changed to Left. However this does not happen when clicking on the clear (x) button. How to stop the alignment change to Left? Last edited: Jan 15, 2025
Using the code below, I can Center the alignment of text. B4X: Copy B4XFloatTextField.TextField.SetTextAlignment("CENTER", "CENTER") For Password Field, when I click the reveal (eye) button, the alignment changed to Left. However this does not happen when clicking on the clear (x) button. How to stop the alignment change to Left?
Solution Erel Jan 16, 2025 Code: Copy Private Sub B4XFloatTextField1_PasswordRevealChanged (Revealed As Boolean) Sender.As(B4XFloatTextField).TextField.SetTextAlignment("CENTER", "CENTER") End Sub It works fine. And the movement isn't noticeable in release mode.
Code: Copy Private Sub B4XFloatTextField1_PasswordRevealChanged (Revealed As Boolean) Sender.As(B4XFloatTextField).TextField.SetTextAlignment("CENTER", "CENTER") End Sub It works fine. And the movement isn't noticeable in release mode.
Alexander Stolte Expert Licensed User Longtime User Jan 15, 2025 #2 aeric said: How to stop the alignment change to Left? Click to expand... will not be possible without customizing the class, as the text field will be rebuilt each time you switch. But maybe @Erel will build in a property for this, so that this is taken into account when rebuilding. Upvote 0
aeric said: How to stop the alignment change to Left? Click to expand... will not be possible without customizing the class, as the text field will be rebuilt each time you switch. But maybe @Erel will build in a property for this, so that this is taken into account when rebuilding.
aeric Expert Licensed User Longtime User Jan 15, 2025 #3 Alexander Stolte said: will not be possible without customizing the class, as the text field will be rebuilt each time you switch. But maybe @Erel will build in a property for this, so that this is taken into account when rebuilding. Click to expand... I just checked the source, it is indeed calling CreateTextFieldAll and CreateTextField after SwitchFromPasswordToRegular(ToRegular As Boolean). Upvote 0
Alexander Stolte said: will not be possible without customizing the class, as the text field will be rebuilt each time you switch. But maybe @Erel will build in a property for this, so that this is taken into account when rebuilding. Click to expand... I just checked the source, it is indeed calling CreateTextFieldAll and CreateTextField after SwitchFromPasswordToRegular(ToRegular As Boolean).
Alexander Stolte Expert Licensed User Longtime User Jan 15, 2025 #4 aeric said: I just checked the source, it is indeed calling CreateTextFieldAll and CreateTextField after SwitchFromPasswordToRegular(ToRegular As Boolean). Click to expand... I studied the soruce code when I developed my AS_TextFieldAdvanced and it stuck in my head Upvote 0
aeric said: I just checked the source, it is indeed calling CreateTextFieldAll and CreateTextField after SwitchFromPasswordToRegular(ToRegular As Boolean). Click to expand... I studied the soruce code when I developed my AS_TextFieldAdvanced and it stuck in my head
Erel B4X founder Staff member Licensed User Longtime User Jan 16, 2025 #5 You should handle the PasswordRevealChanged event and set the alignment. It happens because the underlying text field is replaced with a new one. Upvote 0
You should handle the PasswordRevealChanged event and set the alignment. It happens because the underlying text field is replaced with a new one.
aeric Expert Licensed User Longtime User Jan 16, 2025 #6 Erel said: You should handle the PasswordRevealChanged event and set the alignment. It happens because the underlying text field is replaced with a new one. Click to expand... I tried the following code: B4X: Copy Private Sub txtPinCode_PasswordRevealChanged (Revealed As Boolean) txtPinCode.TextField.SetTextAlignment("CENTER", "CENTER") End Sub The dots moves from left to center very quickly and disappeared. Upvote 0
Erel said: You should handle the PasswordRevealChanged event and set the alignment. It happens because the underlying text field is replaced with a new one. Click to expand... I tried the following code: B4X: Copy Private Sub txtPinCode_PasswordRevealChanged (Revealed As Boolean) txtPinCode.TextField.SetTextAlignment("CENTER", "CENTER") End Sub The dots moves from left to center very quickly and disappeared.
Erel B4X founder Staff member Licensed User Longtime User Jan 16, 2025 #7 Code: Copy Private Sub B4XFloatTextField1_PasswordRevealChanged (Revealed As Boolean) Sender.As(B4XFloatTextField).TextField.SetTextAlignment("CENTER", "CENTER") End Sub It works fine. And the movement isn't noticeable in release mode. Upvote 0 Solution
Code: Copy Private Sub B4XFloatTextField1_PasswordRevealChanged (Revealed As Boolean) Sender.As(B4XFloatTextField).TextField.SetTextAlignment("CENTER", "CENTER") End Sub It works fine. And the movement isn't noticeable in release mode.
aeric Expert Licensed User Longtime User Jan 16, 2025 #8 I tried in released mode. It is not happening all the time. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 16, 2025 #9 It happens because the text field is replaced and then the event is raised with CallSubDelayed. I don't think that you will be able to workaround it without modifying the source code. It is possible add B4XFloatTextField to your project and keep using XUI Views. You can then change the event to use CallSub instead of CallSubDelayed. Upvote 0
It happens because the text field is replaced and then the event is raised with CallSubDelayed. I don't think that you will be able to workaround it without modifying the source code. It is possible add B4XFloatTextField to your project and keep using XUI Views. You can then change the event to use CallSub instead of CallSubDelayed.