Drifter Posted July 9, 2010 Share Posted July 9, 2010 (edited) Hopefully my topic title is descriptive enough. What i want is the following: I have a Gui window that keeps track of applications, the user is able to click a button that allows them to add an application to track. This button opens a new window which requires them to enter appropriate information. When this window is open i want the user to not be able to get other windows focus. They must fill out the information on the window/close it to proceed (ill take care of adding the needed controls) Does anyone know what im talking about? This behavior for a GUI window is seen in many programs these days, (Like the save dialog in Notepad) Thanks for any help! -Drifter Edited July 9, 2010 by Drifter Link to comment Share on other sites More sharing options...
Authenticity Posted July 10, 2010 Share Posted July 10, 2010 expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Enum $iOk, $iCancel _Main() Func _Main() Local $hGUI, $LabelDataRet, $BtnShowDlg $hGUI = GUICreate("Title", 300, 300) $LabelDataRet = GUICtrlCreateLabel("", 20, 180, 260, 25, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $BtnShowDlg = GUICtrlCreateButton("Open", 125, 140, 70, 23) GUISetState() While 1 Switch GUIGetMsg() Case $BtnShowDlg $sRet = _ShowModalDialog($hGUI) If @error = $iOk Then GUICtrlSetData($LabelDataRet, $sRet) Case $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit EndSwitch WEnd EndFunc Func _ShowModalDialog($hParent) Local $hDlg, $BtnOK, $BtnCancel, $Input, $iReturn, $sReturn $hDlg = GUICreate("Dialog", 300, 100, -1, -1, -1, -1, $hParent) $Input = GUICtrlCreateInput("", 20, 20, 260, 25) $BtnOK = GUICtrlCreateButton("&Ok", 130, 55, 70, 23) $BtnCancel = GUICtrlCreateButton("&Cancel", 210, 55, 70, 23) GUISetState(@SW_DISABLE, $hParent) GUISetState(@SW_SHOW, $hDlg) While 1 Switch GUIGetMsg() Case $BtnCancel, $GUI_EVENT_CLOSE $iReturn = $iCancel ExitLoop Case $BtnOK $iReturn = $iOk $sReturn = GUICtrlRead($Input) ExitLoop EndSwitch WEnd GUISetState(@SW_ENABLE, $hParent) GUIDelete($hDlg) Return SetError($iReturn, 0, $sReturn) EndFunc Link to comment Share on other sites More sharing options...
Yoriz Posted July 10, 2010 Share Posted July 10, 2010 The first input will only be ticked if '1' or 'one' is entered, the next if '2' or 'two' and the third '3' or 'three', these can be changed by altering the apropriate $sAllowedIn, only once all 3 have aceptable info entered will the button be active to continue. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $hWndChanged _Gui1() Func _Gui1() #Region ### START Koda GUI section ### Form= Local $Form1 = GUICreate("Form1", 244, 218, -1, -1) Local $hButton1 = GUICtrlCreateButton("Open 2nd Gui", 84, 96, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hButton1 _Gui2($Form1) EndSwitch WEnd EndFunc ;==>_Gui1 Func _Gui2($hParent) GUISetState(@SW_DISABLE, $hParent) #Region ### START Koda GUI section ### Form= Local $Form2 = GUICreate("Form2", 161, 159, -1, -1, BitOR($WS_CAPTION, $WS_DLGFRAME), -1, $hParent) Local $sInputs = GUICtrlCreateInput("", 8, 8, 121, 21) Local $sLabels = GUICtrlCreateLabel("r", 136, 8, 16, 21, $SS_CENTER) GUICtrlSetFont(-1, 12, 400, 0, "Webdings") $sInputs &= "|" & GUICtrlCreateInput("", 8, 40, 121, 21) $sLabels &= "|" & GUICtrlCreateLabel("r", 136, 40, 16, 21, $SS_CENTER) GUICtrlSetFont(-1, 12, 400, 0, "Webdings") $sInputs &= "|" & GUICtrlCreateInput("", 8, 72, 121, 21) $sLabels &= "|" & GUICtrlCreateLabel("r", 136, 72, 16, 21, $SS_CENTER) GUICtrlSetFont(-1, 12, 400, 0, "Webdings") Local $hButton1 = GUICtrlCreateButton("Continue", 40, 104, 75, 25) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $aInputs = StringSplit($sInputs, "|") Local $aLabels = StringSplit($sLabels, "|") Local $sAllowedIn1 = "One|1" Local $sAllowedIn2 = "Two|2" Local $sAllowedIn3 = "Three|3" Local $aAllowed[4] = [0, $sAllowedIn1, $sAllowedIn2, $sAllowedIn3] GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Local $nMsg = GUIGetMsg() Select Case $hWndChanged For $i = 1 To $aInputs[0] Step 1 If GUICtrlGetHandle($aInputs[$i]) = $hWndChanged Then ExitLoop Next Local $sRead = GUICtrlRead($aInputs[$i]) Local $aCheckfor = StringSplit($aAllowed[$i], "|") Local $fOk = False For $i2 = 1 To $aCheckfor[0] Step 1 If $sRead = $aCheckfor[$i2] Then $fOk = True Next If $fOk Then GUICtrlSetData($aLabels[$i], "a") Else GUICtrlSetData($aLabels[$i], "r") EndIf Local $fAllChecked = True For $i = 1 To $aLabels[0] Step 1 If GUICtrlRead($aLabels[$i]) = "r" Then $fAllChecked = False Next If $fAllChecked Then If BitAND(GUICtrlGetState($hButton1), $GUI_DISABLE) Then GUICtrlSetState($hButton1, $GUI_ENABLE) Else If BitAND(GUICtrlGetState($hButton1), $GUI_ENABLE) Then GUICtrlSetState($hButton1, $GUI_DISABLE) EndIf $hWndChanged = "" Case $nMsg = $hButton1 GUIDelete($Form2) GUISetState(@SW_ENABLE, $hParent) ExitLoop EndSelect WEnd EndFunc ;==>_Gui2 Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom = $ilParam Local $nNotifyCode = BitShift($iwParam, 16) Switch $nNotifyCode Case $EN_CHANGE $hWndChanged = $hWndFrom EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
Drifter Posted July 10, 2010 Author Share Posted July 10, 2010 (edited) From just copy pasting these into SCITE it seems that Authenticity's solution is most like what im looking for, i will have to look and see if i can understand what is going on in each line as im somewhat new to this, but it seems like most of the work is done by the following lines: (34) $hDlg = GUICreate("Dialog", 300, 100, -1, -1, -1, -1, $hParent) (39) GUISetState(@SW_DISABLE, $hParent) (40) GUISetState(@SW_SHOW, $hDlg) (55) GUISetState(@SW_ENABLE, $hParent) The rest i could customize, add my own desired buttons and responses etc. Is this correct? PS: Sorry Yoriz, thats not exactly what i was looking for. However, its a very interesting and neat thing which i might use at some point, thank you! ---- Edit: Or basically, the disabling of the main window since AutoIt recognises the second gui window as a child window. I hope my thinking is correct. Edited July 10, 2010 by Drifter Link to comment Share on other sites More sharing options...
Drifter Posted July 10, 2010 Author Share Posted July 10, 2010 okay, it seems like everything works, thank you all very much! 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