TcxMaskEdit for password field - c++builder

I have a EditText declarated as TcxMaskEdit for password field and when I write on it the characters show as ***** but I want that sometimes show the characters, but I don´t find the method for that.

Have you tried simply using a normal TEdit with its PasswordChar property set as desired? You can set it to '*' when you want to hide the password, and set it to 0 when you want to show the password.

Have you tried simply using a normal TEdit with its PasswordChar property set as desired? You can set it to '*' when you want to hide the password, and set it to 0 when you want to show the password.
This perfectly works.
Then I add, answering to your doubt (Jjreina) of showing and not
First, put a SpeedButton by the side of the Edit where the password will be typed
Then in the Events of the SpeedButton
OnMouseDown
(Here you're gonna show the password when you click)
Edit2->PasswordChar=0;
2-> the number of your edit.
0-> is the default value for showing the characters on the edit
OnMouseUp
(Here you're gonna hide it again when you release the button)
Edit2->PasswordChar='*';
Change the property again to show * instead of the characters
Finally in the property Glyph of the speed button you can put an image (of an eye for example) , this just for the icing on the cake 😎
Hope it works for you, and be useful the answer

Related

When typing at the end of the editmask, it will pass the number to the left side until it reaches the last one

Good afternoon,
I'm doing a project in delphi that uses editmask. I'm using the phone mask.
When clicking on edit to write the phone number, it goes to the last field on the right, so it is necessary to go back with the backspace to the beginning of the edit on the left.
i would like to find a way that when the user typed the number in the last field on the right, it was passed to the left. So on until you complete the phone field. It would be possible?
Using an example of what it would look like:
I couldn't think of a way to do it
The component is called TMaskEdit.
Just like anything that bases on TEdit putting the focus onto the control will by default put the text cursor at the end of its content
via keyboard, should .AutoSelect be FALSE and
via mouse if clicking behind any text (by default the text is aligned to the left).
You should have experienced this with the other components already. If you want the text cursor to always be at a certain position upon focusing the control, then do that in such an event handler:
for keyboard use OnEnter:
procedure TForm1.MaskEdit1Enter(Sender: TObject);
begin
(Sender as TMaskEdit).SelStart:= 1; // Second position
end;
and for mouse use OnClick with the same code.
It even works unbound to how the property .AutoSelect is set.
Using Backspace is the worst choice input wise, as it always deletes potential content and needs to be pressed several times to go to the first position. Why not using the Home key instead?

Password textfield gets cleared on toggling show/hide password button

I have a UI that includes a password entry field and a show/hide button. A tester has pointed out the following inconsistent behaviour.
If the password is hidden and half typed in (e.g. "abc") and the user hits the toggle button to show the password and continues typing then the new characters (e.g. "def") are added to the end of the initial entry (making "abcdef"). All well and good.
However, if the password is shown and half typed in (e.g. "abc") and the user hits the toggle button to hide the password and continues typing then the new characters (e.g. "def") replace the initial entry (making "def"). So the show/hide toggle not only shows or hides the text but also changes the behaviour of the UITextField (append / clear and start over) when the next character is entered.
Why is this happening?
Correct it is normal behaviour of UITextField and you can fix this using:
textField.clearsOnBeginEditing = NO;
Or in Swift:
textField.clearsOnBeginEditing = false
But it will not work if you use secure text for password.
See One of the answer:
Secure UITextField Answer
you can realization the effect you want by change your mind.
you can init a NSString *pwd to store the user's password, when user del or replace password , you change your pwd value, make sure your pwd always equal to user's typed password.
when user click the toggle button,you show the pwd value on the textfield.

Write constraint to validate a field based on the value entered in another field in Orbeon Form Builder

I want to validate the size of the phone number field based on the selection made in the Phone Type field. Cell numbers should be 10 in size, Home and work numbers should be 11 in size. How would I write the constraint expression in Orbeon Form Builder. I tried using if in the constraint field, but was unsuccessful.
Thank you for your help!
Let's say you have two controls: a phone type and a phone number.
Create the phone type control, for instance as a drop-down or radio buttons. Give it a name, clicking on the cogwheel to open Edit Control Details. Say that name is phone-type. You will will refer later to the value selected by users as $phone-type.
Edit the items and keep in mind the value you assign to each item. The value is what you will use later, while the label is what is displayed to end users in the form. Say the values are work and mobile.
Create a single line control (text field), click on the red exclamation mark to open the Edit Validation Properties dialog, and there, under Constraint, write:
string-length(.) = (if ($phone-type = 'work') then 11 else 10)

How to move the focus to the next component in Blackberry?

Can anyone tell me how to move the focus to the next component in the screen?
I have one verticalmanager with verticalscroll. This vertical field manager consists of an edit field with approximately 100 lines of data. Below this vertical field manager I have one button. If I want to move my focus to that button it means I have to pass through all those 100 lines in that edit field.
Is there another way to pass the focus to the button directly by clicking a single button?
Based on Richard's answer and your comment, I think the correct way to set the focus on the submit button when the ESC key is pressed in the edit field is as follows:
public boolean keyChar(char key, int status, int time)
{
if (key==Characters.ESCAPE)
{
submit.setFocus();
}
return super.keyChar(key, status, time);
}
Note: The use of the ESCAPE key might not be the best option. You might want to check if a modifier key (such as Alt) is pressed by checking the status argument and set the focus in that case. You are advised to use your discernment when using this code.
You would have to extend one of the containers of the edit field, process key presses looking for the key press you select (it will have to be one not consumed by the edit field). When received call the setFocus() method on the button.
You could make the field with the 100 lines of text unfocusable. When it is unfocusable, and you scroll over it, the cursor should skip the 100 lines, and go straight to the button at the bottom.
There are options:
use navigationMove (if dx > some value) if edit field not in edit mode
use menu instead of buttons
use hotkeys
use paging in list so there will be no scrolling

read-only Textbox

The form window(chat window) that i am creating for a lan messenger is similar to the one in google talk with two textboxes. What i need to do is to transfer characters typed in the lower textbox(textbox2) to the upper textbox(textbox1 which is read-only) when i click the submit button without showing that textbox1 is read-only because the characters are appearing in grey.please help with code if possible.
Use a label for this instead of a textbox. If the only thing it is doing is display the characters and not a direct edit, you won't lose any functionality and the text would not be greyed out...
If you're going to use a Texbox, set it to Locked. That shouldn't gray the characters out. Otherwise in KeyDown/KeyUp events, set the e.Handled property to true (which will tell the box that you want to handle the input yourself and don't want the message to filter down).
That oughta do it for you.

Resources