Jump to content



Photo

Delete & Recreate an Item in Tab, but without it showing in other Tabs.


  • Please log in to reply
7 replies to this topic

#1 guinness

guinness

    guinness

  • MVPs
  • 10,234 posts

Posted 25 November 2010 - 07:32 PM

Here is a list of Examples to Show/Hide a Password Input (I recommend V3)
V1: >> http://www.autoitscript.com/forum/topic/122544-delete-recreate-an-item-in-tab-but-without-it-showing-in-other-tabs/page__view__findpost__p__850919
V2: >> http://www.autoitscript.com/forum/topic/122544-delete-recreate-an-item-in-tab-but-without-it-showing-in-other-tabs/page__view__findpost__p__856358
V3: >> http://www.autoitscript.com/forum/topic/122544-delete-recreate-an-item-in-tab-but-without-it-showing-in-other-tabs/page__view__findpost__p__890838

This was the Original query before it was solved.
Spoiler

Edited by guinness, 06 May 2011 - 06:40 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013






#2 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,301 posts

Posted 25 November 2010 - 09:50 PM

guinness,

From the Tabs tutorial in the Wiki: :graduated:

If you need to add controls after having ended the tab structure definiton, then you must use GUISwitch with the tabitemID parameter to select the correct tab before you create the control or you will find that it is visible on all tabs.

That should solve your problem. :(

M23
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#3 guinness

guinness

    guinness

  • MVPs
  • 10,234 posts

Posted 25 November 2010 - 10:39 PM

Thanks for the advice and sorry for using your name in the OP, I wasn't specifying that you should help me, merely praising you for your original function :( I was hoping the Tab UDF would be a last resort but I suppose I knew it was coming :graduated: Thank you.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#4 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,301 posts

Posted 26 November 2010 - 12:19 PM

guinness,

No need for the Tab UDF - just do as I said. Look for the <<<<<<<<<<<<<<<<<<< lines: :graduated:
AutoIt         
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> Global $GUI, $tab3, $dInput ; make these Global <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _Main() Func _Main()     Local $Button, $Msg     $GUI = GUICreate("GUI", 220, 120)     GUICtrlCreateTab(10, 10, 200, 100)     GUICtrlCreateTabItem("Tab_1")     GUICtrlCreateTabItem("Tab_2")     $tab3 = GUICtrlCreateTabItem("Tab_3")     GUICtrlSetState(-1, $GUI_SHOW)     $dInput = GUICtrlCreateInput("", 20, 52.5, 110, 20, 0x0020)     $Button = GUICtrlCreateButton("Show", 140, 50, 50)     GUICtrlCreateTabItem("")     GUISetState(@SW_SHOW)     While 1         $Msg = GUIGetMsg()         If $Msg = $GUI_EVENT_CLOSE Then ExitLoop         If $Msg = $Button Then             ConsoleWrite("ID Of Input Before >> " & $dInput & @CRLF)             _DisplayPassword() ; Show/Hide Password Input.             Switch GUICtrlRead($Button) ; Change Button Text.                 Case "Show"                     GUICtrlSetData($Button, "Hide")                 Case "Hide"                     GUICtrlSetData($Button, "Show")             EndSwitch             ConsoleWrite("ID Of Input After >> " & $dInput & @CRLF)             ConsoleWrite("THE SAME!" & @CRLF)         EndIf     WEnd EndFunc   ;==>_Main Func _DisplayPassword()     If Not IsDeclared("Global_DisplayPassword") Then Global $Global_DisplayPassword = 0     Local $dInputStyle = -1     Switch $Global_DisplayPassword         Case 0             $Global_DisplayPassword = 1         Case 1             $dInputStyle = 0x0020             $Global_DisplayPassword = 0     EndSwitch     Local $dInputRead = GUICtrlRead($dInput)     Local $dInputGetPos = ControlGetPos($GUI, "", $dInput)     GUICtrlDelete($dInput)     GUISwitch($GUI, $tab3) ; Switch to the correct tab <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     $dInput = GUICtrlCreateInput($dInputRead, $dInputGetPos[0], $dInputGetPos[1], $dInputGetPos[2], $dInputGetPos[3], $dInputStyle)     GUICtrlCreateTabItem("") ; IMPORTANT - must reclose the tab definition here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<     GUISwitch($GUI) ; Switch back to the main GUI <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndFunc   ;==>_DisplayPassword

Told you! :(

M23
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#5 guinness

guinness

    guinness

  • MVPs
  • 10,234 posts

Posted 26 November 2010 - 02:23 PM

THANKS! I have never heard of GUISwitch() I thought it meant the Switch...EndSwitch with GUIGetMsg() and then using the UDF InsertTab and check the CurrentFocus etc... So I learnt two things today. Wow! :graduated:

Example_1: (Thanks to Melba23)
AutoIt         
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> _Main() Func _Main()     Local $hGUI, $iButton, $iInput, $iTab_3     $hGUI = GUICreate("GUI", 220, 120)     GUICtrlCreateTab(10, 10, 200, 100)     GUICtrlCreateTabItem("Tab_1")     GUICtrlCreateTabItem("Tab_2")     $iTab_3 = GUICtrlCreateTabItem("Tab_3")     GUICtrlSetState(-1, $GUI_SHOW)     $iInput = GUICtrlCreateInput("", 20, 52.5, 110, 20, 0x0020)     $iButton = GUICtrlCreateButton("Show", 140, 50, 50)     GUICtrlCreateTabItem("")     GUISetState(@SW_SHOW)     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE                 Exit             Case $iButton                 _DisplayPassword($hGUI, $iInput, $iTab_3) ; Show/Hide Password Input.                 Switch GUICtrlRead($iButton) ; Change Button Text.                     Case "Show"                         GUICtrlSetData($iButton, "Hide")                     Case "Hide"                         GUICtrlSetData($iButton, "Show")                 EndSwitch         EndSwitch     WEnd EndFunc   ;==>_Main Func _DisplayPassword($hHandle, $iControlID, $iTab = -1)     Local $aControlGetPos, $bExStyle = -1, $sRead     If IsDeclared("Global_DisplayPassword") = 0 Then         Global $Global_DisplayPassword = 0     EndIf     Switch $Global_DisplayPassword         Case 0             $Global_DisplayPassword = 1         Case 1             $bExStyle = 0x0020             $Global_DisplayPassword = 0     EndSwitch     $sRead = GUICtrlRead($iControlID)     $aControlGetPos = ControlGetPos($hHandle, "", $iControlID)     GUICtrlDelete($iControlID)     If $iTab <> -1 Then         GUISwitch($hHandle, $iTab)     EndIf     $iControlID = GUICtrlCreateInput($sRead, $aControlGetPos[0], $aControlGetPos[1], $aControlGetPos[2], $aControlGetPos[3], $bExStyle)     If $iTab <> -1 Then         GUICtrlCreateTabItem("")         GUISwitch($hHandle)     EndIf     Return $iControlID EndFunc   ;==>_DisplayPassword

Edited by guinness, 06 May 2011 - 06:21 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#6 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,301 posts

Posted 26 November 2010 - 02:27 PM

guinness,

My pleasure as always. :graduated:

GUISwitch is one of those functions buried in the Help file that you very rarely use, but which is absolutely essential on certain occasions! :(

M23
StringSize - Automatically size controls to fit text - ExtMsgBox - A user customisable replacement for MsgBox

Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs

Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames

GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes

ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display

RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options

GUIListViewEx - Insert, delete, move, drag and sort ListView items


#7 guinness

guinness

    guinness

  • MVPs
  • 10,234 posts

Posted 16 December 2010 - 10:55 PM

UPDATE: Now it supports Multiple Password Inputs. Before it was using a single Global Variable, but it has been optimised to use an Array to store the Input ControlID's and the respective state. See the Example for more details.

Example_2:
AutoIt         
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> _Main() Func _Main()     Local $hGUI, $iButton_1, $iButton_2, $iButton_3, $iInput_1, $iInput_2, $iInput_3, $iTab_1, $iTab_3     $hGUI = GUICreate("GUI", 220, 150)     GUICtrlCreateTab(10, 10, 200, 100)     $iTab_1 = GUICtrlCreateTabItem("Tab_1")     $iInput_1 = GUICtrlCreateInput("", 20, 52.5, 110, 20, 0x0020)     $iButton_1 = GUICtrlCreateButton("Show", 140, 50, 50)     GUICtrlCreateTabItem("Tab_2")     $iTab_3 = GUICtrlCreateTabItem("Tab_3")     GUICtrlSetState(-1, $GUI_SHOW)     $iInput_3 = GUICtrlCreateInput("", 20, 52.5, 110, 20, 0x0020)     $iButton_3 = GUICtrlCreateButton("Show", 140, 50, 50)     GUICtrlCreateTabItem("")     $iInput_2 = GUICtrlCreateInput("", 20, 117.5, 110, 20, 0x0020)     $iButton_2 = GUICtrlCreateButton("Show", 140, 115, 50)     GUISetState(@SW_SHOW)     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE                 Exit             Case $iButton_1                 _DisplayPassword($hGUI, $iInput_1, $iTab_1) ; Show/Hide Password Input.                 Switch GUICtrlRead($iButton_1) ; Change Button Text.                     Case "Show"                         GUICtrlSetData($iButton_1, "Hide")                     Case "Hide"                         GUICtrlSetData($iButton_1, "Show")                 EndSwitch             Case $iButton_2                 _DisplayPassword($hGUI, $iInput_2) ; Show/Hide Password Input. And Because It's Not In A Tab, We Don't Specify The Tab Variable.                 Switch GUICtrlRead($iButton_2) ; Change Button Text.                     Case "Show"                         GUICtrlSetData($iButton_2, "Hide")                     Case "Hide"                         GUICtrlSetData($iButton_2, "Show")                 EndSwitch             Case $iButton_3                 _DisplayPassword($hGUI, $iInput_3, $iTab_3) ; Show/Hide Password Input.                 Switch GUICtrlRead($iButton_3) ; Change Button Text.                     Case "Show"                         GUICtrlSetData($iButton_3, "Hide")                     Case "Hide"                         GUICtrlSetData($iButton_3, "Show")                 EndSwitch         EndSwitch     WEnd EndFunc   ;==>_Main Func _DisplayPassword($hHandle, $iControlID, $iTab = -1)     Local $aControlGetPos, $bExStyle = -1, $iIndex = -1, $iType = 0, $sRead     If IsDeclared("Global_DisplayPassword") = 0 Then         Global $Global_DisplayPassword[1][2] = [[0, 2]]     EndIf     For $A = 1 To $Global_DisplayPassword[0][0]         If @error Then             ExitLoop         EndIf         If $Global_DisplayPassword[$A][0] = $iControlID Then             $iIndex = $A             $iType = $Global_DisplayPassword[$iIndex][1]             ExitLoop         EndIf     Next     If $iIndex = -1 Then         If $Global_DisplayPassword[0][0] <= UBound($Global_DisplayPassword, 1) + 1 Then             ReDim $Global_DisplayPassword[($Global_DisplayPassword[0][0] + 1) * 2][$Global_DisplayPassword[0][1]]         EndIf         $Global_DisplayPassword[0][0] += 1         $iIndex = $Global_DisplayPassword[0][0]         $Global_DisplayPassword[$iIndex][0] = $iControlID         $Global_DisplayPassword[$iIndex][1] = $iType     EndIf     Switch $iType         Case 0             $Global_DisplayPassword[$iIndex][1] = 1         Case 1             $bExStyle = 0x0020             $Global_DisplayPassword[$iIndex][1] = 0     EndSwitch     $sRead = GUICtrlRead($iControlID)     $aControlGetPos = ControlGetPos($hHandle, "", $iControlID)     GUICtrlDelete($iControlID)     If $iTab <> -1 Then         GUISwitch($hHandle, $iTab)     EndIf     $iControlID = GUICtrlCreateInput("", $aControlGetPos[0], $aControlGetPos[1], $aControlGetPos[2], $aControlGetPos[3], $bExStyle)     If $iTab <> -1 Then         GUICtrlCreateTabItem("")         GUISwitch($hHandle)     EndIf     GUICtrlSetData($iControlID, $sRead)     Return $Global_DisplayPassword[$iIndex][1] EndFunc   ;==>_DisplayPassword

Edited by guinness, 06 May 2011 - 06:18 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#8 guinness

guinness

    guinness

  • MVPs
  • 10,234 posts

Posted 06 May 2011 - 06:40 PM

Thanks entirely to smartee for pointing out this little trick. You can find the initial forum post here >> http://www.autoitscript.com/forum/topic/128360-change-a-gui-input-to-password/page__view__findpost__p__890778

Example_3:
AutoIt         
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> _Main() Func _Main()     Local $hGUI, $iButton, $iInput, $iReturn     $hGUI = GUICreate("GUI", 220, 120)     GUICtrlCreateTab(10, 10, 200, 100)     GUICtrlCreateTabItem("Tab_1")     GUICtrlCreateTabItem("Tab_2")     GUICtrlCreateTabItem("Tab_3")     GUICtrlSetState(-1, $GUI_SHOW)     $iInput = GUICtrlCreateInput("", 20, 52.5, 110, 20, 0x0020)     $iButton = GUICtrlCreateButton("Show", 140, 50, 50)     GUICtrlCreateTabItem("")     GUISetState(@SW_SHOW)     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE                 Exit             Case $iButton                 $iReturn = _DisplayPassword($hGUI, $iInput) ; Show/Hide Password Input.                 Switch $iReturn ; Change Button Text.                     Case 1                         GUICtrlSetData($iButton, "Hide")                     Case Else                         GUICtrlSetData($iButton, "Show")                 EndSwitch         EndSwitch     WEnd EndFunc   ;==>_Main Func _DisplayPassword($hHandle, $iControlID)     Local Const $EM_GETPASSWORDCHAR = 0xD2, $EM_SETPASSWORDCHAR = 0xCC     Local $aControlGetPos, $iPasswordCharacter, $pRect     Switch GUICtrlSendMsg($iControlID, $EM_GETPASSWORDCHAR, 0, 0)         Case 0             $iPasswordCharacter = 9679 ; GUICtrlSendMsg($iControlID, $EM_GETPASSWORDCHAR, 0, 0)         Case Else             $iPasswordCharacter = 0     EndSwitch     GUICtrlSendMsg($iControlID, $EM_SETPASSWORDCHAR, $iPasswordCharacter, 0)     $aControlGetPos = ControlGetPos($hHandle, "", $iControlID) ; GUICtrlSetState($iControlID, $GUI_FOCUS)     $pRect = DllStructGetPtr("int " & $aControlGetPos[0] & ";int " & $aControlGetPos[1] & ";int " & $aControlGetPos[0] + $aControlGetPos[2] & ";int " & $aControlGetPos[1] + $aControlGetPos[3] & ";")     DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hHandle, "ptr", $pRect, "bool", True)     If $iPasswordCharacter = 0 Then         Return 1     EndIf     Return 0 EndFunc   ;==>_DisplayPassword

Update: Thanks to smartee.

Edited by guinness, 11 June 2011 - 09:57 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users