Jump to content

Recommended Posts

Posted

Hi,

I am trying to provide a GUI in my app, and am using the edit controls and it is generally working.  What I have so far for the form is:

   ;Create an edit box with no text in it
   Local $iWidthCell = 70
   GUICtrlCreateLabel("Username", 10, 10, $iWidthCell)
   $Edit_1 = GUICtrlCreateEdit("", 10, 25, 280, 20)
   GUICtrlCreateLabel("Password", 10, 50, $iWidthCell)
   $Edit_2 = GUICtrlCreateEdit("", 10, 65, 280, 20)
   GUICtrlCreateLabel("BaseDN", 10, 90, $iWidthCell)
   $Edit_3 = GUICtrlCreateEdit("", 10, 105, 280, 20)
   GUICtrlCreateLabel("Url", 10, 130, $iWidthCell)
   $Edit_4 = GUICtrlCreateEdit("", 10, 145, 280, 20)

However, I want the 2nd field (the $Edit_2) to be a password field, so I want the data to be obfuscated when the user is entering the password into that field.  I think that I need to use a $ES_PASSWORD parameter, but I just cannot figure out how/where to put that in the GUICtrlCreateEdit() call?? 

 

I know this is probably an extremely stupid question, or I just cannot read the docs correctly, but could someone tell how that $Edit_2 call should be?

Thanks!!!

Jim

Posted

I was able to get the password field to work the way I wanted (obfuscating the typed input) by using the GuiCtrlCreateInput() instead of GuiCtrlCreateEdit() call, but I guess now, the question that I have is what is the difference between GuiCtrlCreateEdit() and GuiCtrlCreateInput() calls? 

I when would one call be used vs. the other?

Should I change all the 4 calls for my form to GuiCtrlCreateInput() calls?

Posted (edited)

Edit is a multi-value, input is single-value, so username and password should be a single-value not a multi-value.

Running code:

PS: When posting code please use <> in the editor bar.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $iWidthCell = 70
    Local $hGUI = GUICreate("Example", 300, 265)
    GUICtrlCreateLabel("Username", 10, 10, $iWidthCell, 20)
    $Edit_1 = GUICtrlCreateInput("", 10, 25, 280, 20)
    GUICtrlCreateLabel("Password", 10, 50, $iWidthCell, 20)
    $Edit_2 = GUICtrlCreateInput("", 10, 65, 280, 20, $ES_PASSWORD)
    GUICtrlCreateLabel("BaseDN", 10, 90, $iWidthCell, 20)
    $Edit_3 = GUICtrlCreateInput("", 10, 105, 280, 20)
    GUICtrlCreateLabel("Url", 10, 130, $iWidthCell, 20)
    $Edit_4 = GUICtrlCreateEdit("", 10, 145, 280, 100)

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($hGUI)
EndFunc

 

Edited by Subz
Updated Example
Posted
59 minutes ago, Subz said:

Edit is a multi-value, input is single-value, so username and password should be a single-value not a multi-value.

Running code:

PS: When posting code please use <> in the editor bar.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $iWidthCell = 70
    Local $hGUI = GUICreate("Example", 300, 265)
    GUICtrlCreateLabel("Username", 10, 10, $iWidthCell, 20)
    $Edit_1 = GUICtrlCreateInput("", 10, 25, 280, 20)
    GUICtrlCreateLabel("Password", 10, 50, $iWidthCell, 20)
    $Edit_2 = GUICtrlCreateInput("", 10, 65, 280, 20, $ES_PASSWORD)
    GUICtrlCreateLabel("BaseDN", 10, 90, $iWidthCell, 20)
    $Edit_3 = GUICtrlCreateInput("", 10, 105, 280, 20)
    GUICtrlCreateLabel("Url", 10, 130, $iWidthCell, 20)
    $Edit_4 = GUICtrlCreateEdit("", 10, 145, 280, 100)

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($hGUI)
EndFunc

Ah, ok, cool :)!  Thanks!

Jim

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...