LondonNDIB Posted June 17, 2007 Share Posted June 17, 2007 I have a gui that has various buttons and controls, etc. When a user clicks the "Add" button, I want them to then have two choices... Add Folder or Add File. So I guess I'm envisioning a 2nd GUI opening up with those selections, then a selectfolder/open file dialogue depending on their choice. The result of that then gets returned to the script. I suppose I'm just clueless on how to work that 2nd GUI (or whatever) in. Suggestions or pointers? Thanks. LD Link to comment Share on other sites More sharing options...
Generator Posted June 17, 2007 Share Posted June 17, 2007 I am not an expert at GUI but this is what i made for a password form(being used in 1 of my project). This should get you going, look through the script carefully and see how the GUI is being create and delete. The way I am doing you won't encounter any bug. expandcollapse popup#Include<GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $Inuse = False, $passwordfrm, $string1, $string2, $password = "" $mainfrm = GUICreate("Main Form", 200, 35, -1, -1, -1) $button0 = GUICtrlCreateButton("Password", 1, 1, 98, 30) $button1 = GUICtrlCreateButton("Check", 99, 1, 98, 30) GUICtrlSetFont($button0, 9, 400, 0, "Tahoma") GUICtrlSetFont($button1, 9, 400, 0, "Tahoma") GUICtrlSetOnEvent($button0, "_PasswordGUI") GUICtrlSetOnEvent($button1, "_ShowPassword") GUISetFont(9, 400, 0, "Tahoma") GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetState() While 1 Sleep(1000) WEnd Func _PasswordGUI() If $Inuse = True Then Return $Inuse = Not $Inuse $passwordfrm = GUICreate("Password Protection", 400, 60, -1, -1, -1, -1, $mainfrm) $label1 = GUICtrlCreateLabel("Type Password: ", 1, 1, 120, 20, $SS_CENTER) $label2 = GUICtrlCreateLabel("Confirm Password: ", 1, 32, 120, 20, $SS_CENTER) $string1 = GUICtrlCreateInput("", 121, 3, 210, 20, $ES_PASSWORD) $string2 = GUICtrlCreateInput("", 121, 32, 210, 20, $ES_PASSWORD) $setbutton = GUICtrlCreateButton("SET", 336, 3, 60, 51, $BS_VCENTER) GUICtrlSetFont($label1, 11, 400, 0, "Tahoma") GUICtrlSetFont($label2, 11, 400, 0, "Tahoma") GUICtrlSetFont($string1, 9, 400, 0, "Tahoma") GUICtrlSetFont($string2, 9, 400, 0, "Tahoma") GUICtrlSetFont($setbutton, 11, 400, 0, "Tahoma") GUICtrlSetOnEvent($setbutton, "_SetPassword") GUISetOnEvent($GUI_EVENT_CLOSE, "Subdel") GUISetState() EndFunc ;==>_PasswordGUI Func _ShowPassword() MsgBox(64, "Password", $password) EndFunc ;==>_ShowPassword Func Subdel() $Inuse = Not $Inuse GUIDelete($passwordfrm) EndFunc ;==>Subdel Func _PasswordChk() If StringLen(GUICtrlRead($string1)) <> StringLen(GUICtrlRead($string2)) Then MsgBox(64, "Password Check", "Please confirm both of your password") Return ElseIf GUICtrlRead($string1) <> GUICtrlRead($string2) Then MsgBox(64, "Password Check", "Please confirm both of your password") Return EndIf Return GUICtrlRead($string2) EndFunc ;==>_PasswordChk Func _SetPassword() Local $ButtonPos = WinGetPos($passwordfrm, "") If IsNumber(_PasswordChk()) = 0 Then $password = GUICtrlRead($string2) ToolTip("Password was set, please remember", $ButtonPos[0] + 370, $ButtonPos[1] + 55, "Result", 1, -1) Sleep(3000) ToolTip("") Return $password Else ToolTip("Password was not set", $ButtonPos[0] + 370, $ButtonPos[1] + 55, "Result", 1, -1) Sleep(3000) ToolTip("") EndIf EndFunc ;==>_SetPassword Func Quit() Exit EndFunc ;==>Quit Link to comment Share on other sites More sharing options...
LondonNDIB Posted June 17, 2007 Author Share Posted June 17, 2007 Thank you very much for the fast response and example! I ran it and that's pretty much exactly what I want, so thank you. I'd like it so the parent window was totally disabled while the child window is active, but I'll take a look in the help files to see if I can figure that out. You've given me exactly what I need to get going. Thanks again. lD 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