Search the Community
Showing results for tags 'child window gui unresponsive'.
-
Hey, I have recently returned to AutoIt after a few years, and am re-learning a lot of things. I have run into a problem that has me stumped. The main window in my program works great. What im trying to do is open up a child window that takes focus from the main window where the user can view/edit some info gathered from a UDF listview control. The user will then be able to either save or cancel once done editing the values in the controls. Gathering the data from the listview and displaying it in the child window works fine, however once the new GUI gets to the loop stage checking GUIGetMsg() it seems to be becoming unresponsive (need to force close the window). I have a few msgbox's in my script just for pinpointing where the script is hanging, so dont worry about those, and its pretty commented so shouldnt be too hard to follow. Ill include the function which contains child GUI window as well as the full script minus functions. Function calling creation of new GUI: Func _EditMember($mem) Local $f, $lc, $i, $line ;Create Edit Member Window $WinEditMem = GUICreate($mem, 595, 227, 384, 145, Default, Default, $WinMain) $LabEditMemName = GUICtrlCreateLabel($mem, 112, 32, 32, 17) $LabEditMemScore = GUICtrlCreateLabel("Score:", 16, 80, 35, 17) $LabEditMemTc = GUICtrlCreateLabel("Troop Count:", 16, 112, 66, 17) $LabEditMemCoord = GUICtrlCreateLabel("Coords", 16, 144, 37, 17) $InputEditMemScore = GUICtrlCreateInput("-", 88, 80, 201, 21) $InputEditMemTc = GUICtrlCreateInput("-", 88, 112, 201, 21) $InputEditMemCoord = GUICtrlCreateInput("-", 88, 144, 201, 21) $EditEditMemNote = GUICtrlCreateEdit("Notes...", 296, 8, 289, 161) $ButtonEditMemSave = GUICtrlCreateButton("Save", 200, 184, 83, 25) $ButtonEditMemCancel = GUICtrlCreateButton("Cancel", 296, 184, 83, 25) GUISetState(@SW_SHOW, $WinEditMem) ;Get member data and display $f = FileOpen($ResDir & "\" & $allypointer & $MemDatatxt) $lc = _FileCountLines($ResDir & "\" & $allypointer & $MemDatatxt) ;Cycle through memdat.txt For $i = 1 to $lc $line = FileReadLine($f, $i) $line = StringSplit($line, "|") If $line[1] = $mem Then ;If the name of the member = name passed to function ;Update controls with member data GUICtrlSetData($InputEditMemTc, $line[2]) GUICtrlSetData($InputEditMemScore, $line[3]) GUICtrlSetData($InputEditMemCoord, $line[4]) ;GUICtrlSetData($InputEditMemCoord, NOTES placeholder) ExitLoop EndIf Next MsgBox(0, "", "1") ;Window events While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox(0, "", "3") ExitLoop Case $ButtonEditMemCancel MsgBox(0, "", "4") ExitLoop EndSwitch WEnd ;Delete window on way out of function MsgBox(0, "", "7") FileClose($f) GUIDelete($WinEditMem) EndFunc Main program: ;========================================================================================== ;Includes #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <File.au3> #include <Array.au3> #include <String.au3> #include <Date.au3> #include <IE.au3> #include <GuiStatusBar.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GuiTab.au3> ;========================================================================================== ;========================================================================================== ;Constant variables Global $WinMainTitle = "King's Empire Alliance Manager" Global $ProgVersion = "v1.00" Global $LastUpdate = "2012/05/02" Global $IsConnect = "Searching..." Global $IsUpToDate = "Searching..." ;Directory paths Global $ResDir = @ScriptDir & "\Resources" ;File names Global $SavedBoardtxt = "\SavedBoard.txt" Global $MsgBoardtxt = "\MsgBoard.html" Global $PrevMemDatatxt = "\PrevMemData.txt" Global $MemDatatxt = "\MemData.txt" Global $Indextxt = "\Index.txt" Global $AllyLogojpg = "\logo.jpg" ;Global varliables Global $totstr = "0" Global $totscore = "0" Global $prevtotscore = "0" Global $prevtotstr = "0" ;Initial allaince to load $f = FileOpen($ResDir & $Indextxt) Global $allypointer = FileReadLine($f, 1) FileClose($f) ;Tab globals Global $tabcur Global $tabprev = "0" ;========================================================================================== ;Declare onexit function OnAutoItExitRegister( "_OnExit") $WinMain = GUICreate($WinMainTitle, 750, 675) ;Tabs $TabMain = _GUICtrlTab_Create($WinMain, 16, 95, 721, 20) ;Status bar Local $vPartEdge[2] = [500, 600] Local $vPartText[2] = [@Tab & _NowDate(), @TAB & $IsConnect] $StatusBarMain = _GUICtrlStatusBar_Create($WinMain, $vPartEdge, $vPartText) Global $AllyPic = GUICtrlCreatePic($ResDir & "\" & $allypointer & $AllyLogojpg, 16, 15, 400, 100) $LabelMainLastUpdate = GUICtrlCreateLabel("Last Updated:", 428, 25, 70, 17) $LabLastUpdate = GUICtrlCreateLabel($LastUpdate, 503, 25, 80, 17) $LabIsUpToDate = GUICtrlCreateLabel($IsUpToDate, 473, 45, 80, 17) $LabMainProgVersion = GUICtrlCreateLabel($ProgVersion, 712, 5, 31, 17) $ButtonMainConnect = GUICtrlCreateButton("Connect", 430, 85, 147, 17) $ButtonMainSync = GUICtrlCreateButton("Sync", 592, 24, 147, 17) $ButtonMainWiki = GUICtrlCreateButton("WiKi", 592, 48, 147, 17) $ButtonMainMaps = GUICtrlCreateButton("Maps", 592, 72, 147, 17) $ButtonMainChat = GUICtrlCreateButton("Chat", 592, 96, 147, 17) ;Group alliance $GroupMainAlly = GUICtrlCreateGroup("Alliance:-", 16, 120, 721, 115) $LabMainAllyStr = GUICtrlCreateLabel("Total Strength:", 120, 183, 74, 17) $LabMainAllyScore = GUICtrlCreateLabel("Total Score:", 120, 208, 62, 17) $AllyStr = GUICtrlCreateLabel("-", 200, 183, 75, 17) $AllyScore = GUICtrlCreateLabel("-", 200, 208, 75, 17) $ProgressMainAllyStr = GUICtrlCreateProgress(120, 150, 475, 25) GUICtrlSetData(-1, 73) $LabMainStrAllyGainD = GUICtrlCreateLabel("/day", 315, 183, 75, 17) $LabMainStrAllyGainW = GUICtrlCreateLabel("/week", 415, 183, 75, 17) $LabMainStrAllyGainM = GUICtrlCreateLabel("/month", 520, 183, 90, 17) $LabMainScoreAllyGainD = GUICtrlCreateLabel("/day", 315, 208, 75, 17) $LabMainScoreAllyGainW = GUICtrlCreateLabel("/week", 415, 208, 75, 17) $LabMainScoreAllyGainM = GUICtrlCreateLabel("/month", 520, 208, 90, 17) $LabMainAllyHealth = GUICtrlCreateLabel("Health:", 330, 132, 40, 17) ;Group members $GroupMainMembers = GUICtrlCreateGroup("Members:-", 16, 240, 721, 241) $ListViewMainMembers = _GUICtrlListView_Create($WinMain, "", 32, 264, 690, 200, BitOR($LVS_SINGLESEL, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($ListViewMainMembers, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_TWOCLICKACTIVATE, $LVS_EX_DOUBLEBUFFER)) _GUICtrlListView_AddColumn($ListViewMainMembers, "Member", 100) _GUICtrlListView_AddColumn($ListViewMainMembers, "Troops", 145) _GUICtrlListView_AddColumn($ListViewMainMembers, "Score", 145) _GUICtrlListView_AddColumn($ListViewMainMembers, "Co-ordinates", 300) Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($ListViewMainMembers)] ;Group message board $GroupMainMsgBoard = GUICtrlCreateGroup("Message Board:-", 16, 488, 721, 153) $oMainIE = _IECreateEmbedded() $MainIEControl = GUICtrlCreateObj($oMainIE, 27, 505, 700, 125) GUISetState(@SW_SHOW, $WinMain) ;Register interactions with the tab GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _StartUpOperations() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Let me know if you guys need any more of the script or any other info! Hope this is all clear... Thanks for any help Smerk