jlorenz1 Posted November 23, 2006 Share Posted November 23, 2006 Hallo. I've got following problem: I want an input control, which changes dynamically the password plain or in **** depending on the state of checkbox. How does it works? Thanks in advance Ich habe folgendes Problem: Ich möchte ein Inputsteuerelement, das dynmaisch entweder das Passwort blank oder in *** je nach dem Status der Checkbox. Wie geht es nur? Vielen Dank im voraus! Johannes from Germany #include <GUIConstants.au3> GUICreate("Hide/unhide password", 320,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES GUICtrlCreatelabel ( "Give me your password", 10, 5, 300, 20) $checkbox = GUICtrlCreateCheckbox ( "Hide password", 10, 25, 300, 20) GUICtrlSetState ( -1, $GUI_CHECKED) $input = GUICtrlCreateInput ("Password", 10, 55, 300, 20) $btn = GUICtrlCreateButton ("Ok", 250, 85, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $checkbox $i = GUICtrlRead($checkbox) Select Case $i = 1 MsgBox(4096,"Does it works?","Password with *****",2) GUICtrlSetState ($input, $ES_PASSWORD) Case $i = 4 MsgBox(4096,"Does it works?","Password plain",2) GUICtrlSetState ($input, 0) EndSelect Case $msg = $btn exitloop Case else EndSelect Wend Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post] Link to comment Share on other sites More sharing options...
Valuater Posted November 23, 2006 Share Posted November 23, 2006 the answer would be GUICtrlSetStyle() instead of GUICtrlSetState ()... #include <GUIConstants.au3> GUICreate("Hide/unhide password", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES GUICtrlCreateLabel("Give me your password", 10, 5, 300, 20) $checkbox = GUICtrlCreateCheckbox("Hide password", 10, 25, 300, 20) GUICtrlSetState(-1, $GUI_CHECKED) $input = GUICtrlCreateInput("", 10, 55, 300, 20) GUICtrlSetStyle($input, $ES_PASSWORD) GUICtrlSetData( $input, "password") $btn = GUICtrlCreateButton("Ok", 250, 85, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() WEnd however according to help, some styles are not availables with GUICtrlSetStyle() Remarks Some styles cannot be changed dynamically, check MSDN documentation. $CBS_UPPERCASE combo style is one example 8) Link to comment Share on other sites More sharing options...
jlorenz1 Posted November 23, 2006 Author Share Posted November 23, 2006 I tried it without sucess. If the checkbox is activated, the content of the input control should be expressed in *********. If the checkbox isn't activated, the content of the input control should be show blank. Sorry, but with your script the content of the input control is always shown as blank/plain .... Johannes Perhaps you have another idea or works it only with the newest beta version? Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post] Link to comment Share on other sites More sharing options...
Valuater Posted November 23, 2006 Share Posted November 23, 2006 (edited) as stated abovethe answer would be GUICtrlSetStyle() instead of GUICtrlSetState ()...however according to help, some styles are not availables with GUICtrlSetStyle()8) Edited November 23, 2006 by Valuater Link to comment Share on other sites More sharing options...
Developers Jos Posted November 23, 2006 Developers Share Posted November 23, 2006 (edited) try this: Const $EM_SETPASSWORDCHAR = 0xCC Case $msg = $checkbox $i = GUICtrlRead($checkbox) Select Case $i = 1 $Res = GUICtrlSendMsg($input, $EM_SETPASSWORDCHAR, 149, 0) Case $i = 4 $Res = GUICtrlSendMsg($input, $EM_SETPASSWORDCHAR, 0, 0) EndSelect Edited November 23, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valuater Posted November 23, 2006 Share Posted November 23, 2006 that works. 8) Link to comment Share on other sites More sharing options...
jlorenz1 Posted November 23, 2006 Author Share Posted November 23, 2006 i tried this without success. Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post] Link to comment Share on other sites More sharing options...
Valuater Posted November 23, 2006 Share Posted November 23, 2006 post your new code 8) Link to comment Share on other sites More sharing options...
Developers Jos Posted November 23, 2006 Developers Share Posted November 23, 2006 i tried this without success.You need to click on the Password field to refresh it .... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jlorenz1 Posted November 24, 2006 Author Share Posted November 24, 2006 This works, but isn't a 100% solution. Johannes #include <GUIConstants.au3> Const $EM_SETPASSWORDCHAR = 0xCC GUICreate("Show/hide password", 320,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018) GUICtrlCreatelabel ( "Give me your password", 10, 5, 300, 20) $checkbox = GUICtrlCreateCheckbox ( "Hide password", 10, 25, 300, 20) GUICtrlSetState ( -1, $GUI_CHECKED) $inputWithAsterisk = GUICtrlCreateInput ("Password", 10, 55, 300, 20, $ES_PASSWORD) $inputPasswordPlain = GUICtrlCreateInput ("Password", 10, 55, 300, 20) GUICtrlSetState(-1, $GUI_HIDE) $btn = GUICtrlCreateButton ("Ok", 250, 85, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $checkbox $i = GUICtrlRead($checkbox) Select Case $i = 4 MsgBox(4096,'Action','Show password plain') $sInputWAContent = GUICtrlRead($inputWithAsterisk) GUICtrlSetData($inputPasswordPlain,$sInputWAContent) GUICtrlSetState($inputWithAsterisk, $GUI_HIDE) GUICtrlSetState($inputPasswordPlain, $GUI_SHOW) Case $i = 1 MsgBox(4096,'Action','Hide password') $sInputPPContent = GUICtrlRead($inputPasswordPlain) GUICtrlSetData($inputWithAsterisk,$sInputPPContent) GUICtrlSetState($inputPasswordPlain, $GUI_HIDE) GUICtrlSetState($inputWithAsterisk, $GUI_SHOW) EndSelect Case $msg = $btn exitloop Case else EndSelect Wend Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now