Zych Posted March 24, 2010 Share Posted March 24, 2010 Hey Guys, I have a question about the GUI interface I am designing. I have two buttons: Login and Logout. I would like to start off with the Logout greyed out (no need to logout if you have not logged in yet). This I have been able to do. However I would like to grey out the Login button once it is run, then enable the Logout button. I would also like to clear the password user input section (I am using the $ES_PASSWORD setting for this) Here is the code for creating the GUI: $Form1_1 = GUICreate("NAS Login", 625, 208, 192, 124) GUISetBkColor(0x3399FF) $Pic1 = GUICtrlCreatePic("C:\Pictures\logo.jpg", 32, 32, 124, 124, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Button1 = GUICtrlCreateButton("Login", 216, 136, 113, 25, $WS_GROUP) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Logout", 368, 136, 121, 25, $WS_GROUP) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetState(-1, $GUI_DISABLE) $Label1 = GUICtrlCreateLabel("Username:", 223, 32, 79, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Password:", 224, 61, 76, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $UsrName = GUICtrlCreateInput($LastUser, 310, 31, 161, 21) $Pass = GUICtrlCreateInput("", 310, 58, 161, 21, $ES_PASSWORD) $LoginType = GUICtrlCreateCombo("Local", 311, 85, 161, 25) Switch $LoginConn Case 1 GUICtrlSetData(-1, "VPN|WiFi", "Local") Case 2 GUICtrlSetData(-1, "VPN|WiFi", "VPN") Case 3 GUICtrlSetData(-1, "VPN|WiFi", "WiFi") EndSwitch GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xC8C8C8) $Label3 = GUICtrlCreateLabel("Type:", 223, 89, 44, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) How do I go about doing this? Thanks in advance, Zych Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 24, 2010 Moderators Share Posted March 24, 2010 Zych,As I see no GUISetOnEvent lines, i will assume you have a While...WEnd loop with a GUIGetMsg somewhere within.When the "Log In" button is pressed, you do this:GUICtrlSetState($Button2, $GUI_ENABLE) ; Enable Log Out GUICtrlSetState($Button1, $GUI_DISABLE) ; Disable Log inObviously you can do the reverse when pressing the "Log Out" button.To clear the Password controls, just use GUICtrlSetData(ControlID, ""). M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Zych Posted March 24, 2010 Author Share Posted March 24, 2010 Yes I do have the While...WEnd loop with a GUIGetMsg. I will give this a try and thank you for the quick response! Zych Link to comment Share on other sites More sharing options...
Zych Posted March 26, 2010 Author Share Posted March 26, 2010 Tried it this morning and it works great! Thank you once again. 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