Jump to content
Sign in to follow this  
billthecreator

Show password

Recommended Posts

billthecreator

i have a edit box that is used for a password.

i have it so that when it is not selected and there is no text in the box, it should say 'Password'

but it shows it as a password, with the dots

heres is a clip of what i have.

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode
    Local $input1
    $hWndEdit1 = GUICtrlGetHandle($input)
    $hWndFrom = $ilParam
    $iIDFrom = _WinAPI_LoWord($iwParam)
    $iCode = _WinAPI_HiWord($iwParam)
    Switch $hWndFrom
        Case $hWndEdit1
            Switch $iCode
                Case $EN_KILLFOCUS
                    
                    If _GUICtrlEdit_GetTextLen($input) = 0 Then
                        GUICtrlSetData($input, "Password" )
                        GUICtrlSetStyle($input, ); what goes here?
                        GUICtrlSetColor($input, 0x808080)
                    EndIf
                    
                Case $EN_SETFOCUS    
                     If GUICtrlRead($input) = "Password" Then
                        GUICtrlSetData($input, "")
                        GUICtrlSetStyle($input, $ES_PASSWORD)
                        GUICtrlSetColor($input, 0x000000)
                    EndIf
                Case $EN_CHANGE
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc
Edited by billthecreator

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Share this post


Link to post
Share on other sites
Stev

I want the same thing, show the word Password there.

If the user select to write this should remove the word Password and leave the input empty and when user input a password show dots.

Also I want the combo as read only, but I can't take it done.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=form1.kxf
$Form1_1 = GUICreate("Program", 301, 351, 350, 168)
GUISetIcon("app.ico")
$Pic1 = GUICtrlCreatePic("app_logo.gif", 96, 24, 110, 32, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("text 1", 36, 88, 235, 17)
GUICtrlSetCursor (-1, 0)
$Label2 = GUICtrlCreateLabel("text 2", 36, 111, 235, 17)
GUICtrlSetCursor (-1, 0)
$Label3 = GUICtrlCreateLabel("text 3", 36, 134, 235, 17)
GUICtrlSetCursor (-1, 0)
$Label4 = GUICtrlCreateLabel("text 4", 36, 157, 235, 17)
GUICtrlSetCursor (-1, 0)
$Combo1 = GUICtrlCreateCombo("Choose your site...", 96, 248, 121, 25)
GUICtrlSetData(-1, "first|second")
GUICtrlSetResizing(-1, $GUI_DOCKHCENTER+$GUI_DOCKVCENTER+$GUI_DOCKHEIGHT)
GUICtrlCreateInput("name@email.com", 96, 192, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateInput("Password", 96, 216, 121, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
GUISetState(@SW_SHOW)
$OK = GUICtrlCreateButton("OK", 120, 304, 75, 25, 0)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $OK
EndSwitch
WEnd

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×