Salve a tutti,
utilizzo X# in ambiente XIDE ed ho un quesito da porre:
ho una DialogWindow con una SingleLineEdit (quella cerchiata in rosso)
a cui ho assegnato TRUE al campo "PASSWORD" nelle proprietà della DialogWindow
in modo da non far visulizzare i caratteri digitati.
Volevo ora attivare il controllo per cambiare al volo nella mia applicazione la possibilità di visualizzare i caratteri digitati tramite il Metodo ButtonClick grazie al checkBox "Mostra i caratteri" (cerchiato in blu nella prima immagine) ma non so poi come rimuovere lo style "PASSWORD" dalla mia SingleLineEdit (nell'HELP in linea non ho trovato supporto).
Qualcuno sa aiutarmi?
Grazie anticipatamente
Francesco
Modifica della "Style=> Password" di una SingleLineEdit
Modifica della "Style=> Password" di una SingleLineEdit
Hello Francesco,
What I have understood is that you can't change that. I actually never tried that in VO forms but I did try it in a WPF window where I put the little eye icon in front to let the user see what was typed, expecting WPF to somehow support that by default.
But no.
I had to put two controls on top of each other. When I keep the eye button pressed it displays the 'normal' one with the full password visible and otherwise the one with the password style on showing bullets.
I think you have to do the same; show and hide one of each with different styles depending on your checkbox.
Dick
What I have understood is that you can't change that. I actually never tried that in VO forms but I did try it in a WPF window where I put the little eye icon in front to let the user see what was typed, expecting WPF to somehow support that by default.
But no.
I had to put two controls on top of each other. When I keep the eye button pressed it displays the 'normal' one with the full password visible and otherwise the one with the password style on showing bullets.
I think you have to do the same; show and hide one of each with different styles depending on your checkbox.
Dick
Modifica della "Style=> Password" di una SingleLineEdit
Hi Francesco,
Dick is right in that many styles cannot be modified at rutnime, but fortunately this one can actually be changed. Please try the following, it should do the trick:
.
Dick is right in that many styles cannot be modified at rutnime, but fortunately this one can actually be changed. Please try the following, it should do the trick:
Code: Select all
SendMessage( SELF:oDCcVecchia:Handle() , EM_SETPASSWORDCHAR , 0 , 0)
SELF:oDCcVecchia:RePaint()
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Modifica della "Style=> Password" di una SingleLineEdit
Hello Chris,
Ah, so the VO forms support run time change. It looks like this is possible in Winforms too (with TextBox.PasswordChar set to select a character and TextBox.TextMode:= TextBoxMode.Password) and you implemented that too, maybe because as VO forms are based on Winforms?
Only WPF doesn't seem to support that. But more than once WPF looked to me like a half finished product. Promising, but never finished.
Dick
Ah, so the VO forms support run time change. It looks like this is possible in Winforms too (with TextBox.PasswordChar set to select a character and TextBox.TextMode:= TextBoxMode.Password) and you implemented that too, maybe because as VO forms are based on Winforms?
Only WPF doesn't seem to support that. But more than once WPF looked to me like a half finished product. Promising, but never finished.
Dick
Modifica della "Style=> Password" di una SingleLineEdit
Hi Dick,
That's one of the few styles that apparently are supported in standard windows to be changed. In WinForms, you can actually change more or less all of them, they are using a trick as far as I know, they basically automatically re-create a new control with the new style, and they place it in the position of the old one, and then the old one gets destroyed.
Never got familiar enough with WPF to tell what happens there...
.
That's one of the few styles that apparently are supported in standard windows to be changed. In WinForms, you can actually change more or less all of them, they are using a trick as far as I know, they basically automatically re-create a new control with the new style, and they place it in the position of the old one, and then the old one gets destroyed.
Never got familiar enough with WPF to tell what happens there...
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Modifica della "Style=> Password" di una SingleLineEdit
FANTASTICO Chris grazie, ho usato il tuo suggerimento ed in effetti funziona!:
Ora volevo sapere, che parametri utilizzo nel SendMessage per ripristinare lo styile=>Password sulle mie SingleLineEdit?
Dimenticavo, grazie anche a Dick, ho capito cosa mi suggerisce ma nel mio caso è più semplice usare il trucco proposto da Chris.
Saluti
Francesco
Quando flaggo "Mostra caratteri" riesco a disabilitare lo style=>Password delle mie SingleLineEdit dove richiedo l'immissione della PASSWORD.Ora volevo sapere, che parametri utilizzo nel SendMessage per ripristinare lo styile=>Password sulle mie SingleLineEdit?
Dimenticavo, grazie anche a Dick, ho capito cosa mi suggerisce ma nel mio caso è più semplice usare il trucco proposto da Chris.
Saluti
Francesco
Modifica della "Style=> Password" di una SingleLineEdit
You're welcome Francesco!
In order to restore the password style, you need to use this:
So actually you can use any character you want to hide the real characters. But of course "*" is the standard one.
.
In order to restore the password style, you need to use this:
Code: Select all
SendMessage( SELF:oDCSingleLineEdit1:Handle() , EM_SETPASSWORDCHAR , Asc("*") , 0)
SELF:oDCSingleLineEdit1:RePaint()
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Modifica della "Style=> Password" di una SingleLineEdit
Ciao Chris,
in effetti avevo già pensato di utilizzare questa tua soluzione nel mio codice: tuttavia l'effetto che si ottiene utilizzando il carattere "*" è il seguente: che differisce dalla situazione originale: Premetto che nelle proprietà della SingleLineEdit ho impostato come Font: Microsoft San Serif 12
ma non so se questo può essere la causa della differente visualizzazione.
Saluti
Francesco
in effetti avevo già pensato di utilizzare questa tua soluzione nel mio codice: tuttavia l'effetto che si ottiene utilizzando il carattere "*" è il seguente: che differisce dalla situazione originale: Premetto che nelle proprietà della SingleLineEdit ho impostato come Font: Microsoft San Serif 12
ma non so se questo può essere la causa della differente visualizzazione.
Saluti
Francesco
Modifica della "Style=> Password" di una SingleLineEdit
Hi Francesco,
Hmm, I see that, too, after enabling visual styles in the app. Tried that:
SELF:Caption := AsString( SendMessage( SELF:oDCSingleLineEdit1:Handle() , EM_GETPASSWORDCHAR , 0 , 0) )
to get the actual character used, and this returns 9679, but when trying to set it back with
SendMessage( SELF:oDCSingleLineEdit1:Handle() , EM_SETPASSWORDCHAR , 9679 , 0)
then unfortunately it does not work properly, I assume it's because the VOGUI classes are ansi (not unicode) based and the last post here seems to confirm this: https://forums.wxwidgets.org/viewtopic.php?t=15093
Sorry, I don't know of another way to do this, but maybe someone else has some idea...
.
Hmm, I see that, too, after enabling visual styles in the app. Tried that:
SELF:Caption := AsString( SendMessage( SELF:oDCSingleLineEdit1:Handle() , EM_GETPASSWORDCHAR , 0 , 0) )
to get the actual character used, and this returns 9679, but when trying to set it back with
SendMessage( SELF:oDCSingleLineEdit1:Handle() , EM_SETPASSWORDCHAR , 9679 , 0)
then unfortunately it does not work properly, I assume it's because the VOGUI classes are ansi (not unicode) based and the last post here seems to confirm this: https://forums.wxwidgets.org/viewtopic.php?t=15093
Sorry, I don't know of another way to do this, but maybe someone else has some idea...
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
- ArneOrtlinghaus
- Posts: 414
- Joined: Tue Nov 10, 2015 7:48 am
- Location: Italy
Modifica della "Style=> Password" di una SingleLineEdit
I have my doubts with the possibilities of modifying this property "on the fly". I remember only that we had some problems many years ago. Perhaps it is better to add hidden single line edits without the password property and to switch to them.
But possibly something has also changed in the behavior how Microsoft is handling this mode.
Arne
But possibly something has also changed in the behavior how Microsoft is handling this mode.
Arne