Dickb Posted September 17, 2005 Share Posted September 17, 2005 (edited) While creating a script I ran into a problem. I have created a demonstration to show my problem. Start the application, select List in the main window. Now click Add and a row is added. Select Update and then Done. Now click Add again and NO row is added. Goes wrong in the stable version and beta 75. If you disable the GUIDelete in the Update() function everything works. (beside that the update windows stays on screen). Am I overlooking something? Thanks for the support, Dick For some reason the "Code" won't indent any more so please make it readable with Tidy expandcollapse popup#include <GUIConstants.au3> Opt("MustDeclareVars", 1) Main() Exit Func Main() Local $Gui_1, $List, $Done, $msg1 $Gui_1 = GuiCreate("Main", 200, 50) $List = GuiCtrlCreateButton("List", 10, 10, 80, 30) $Done = GuiCtrlCreateButton("Done", 100, 10, 80, 30) GuiSetState(@SW_SHOW) While 1 $msg1 = GuiGetMsg() Select Case $msg1 = $GUI_EVENT_CLOSE ExitLoop Case $msg1 = $Done ExitLoop Case $msg1 = $List List() EndSelect WEnd EndFunc Func Update() Local $Gui_2, $Done, $msg2 $Gui_2 = GuiCreate("Update", 200, 50) $Done = GuiCtrlCreateButton("Done", 10, 10, 80, 30) GuiSetState(@SW_SHOW) While 1 $msg2 = GuiGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE ExitLoop Case $msg2 = $Done ExitLoop EndSelect WEnd GUIDelete($Gui_2) EndFunc Func List() Local $Gui_3, $listview, $Update, $Add, $Done, $msg3 $Gui_3 = GuiCreate("GroupList", 400, 200) $listview = GuiCtrlCreateListView("col1|col2|col3", 0, 0, 400, 150, -1, $LVS_EX_GRIDLINES) GUICtrlCreateListViewItem("line1|data1|more1", $listview) $Update = GuiCtrlCreateButton("Update", 10, 160, 80, 30) $Add = GuiCtrlCreateButton("Add", 100, 160, 80, 30) $Done = GuiCtrlCreateButton("Done", 200, 160, 80, 30) GuiSetState(@SW_SHOW) While 1 $msg3 = GuiGetMsg() Select Case $msg3 = $GUI_EVENT_CLOSE ExitLoop Case $msg3 = $Done ExitLoop Case $msg3 = $Update Update() Case $msg3 = $Add GUICtrlCreateListViewItem("line2|data2|more2", $listview) EndSelect WEnd GUIDelete($Gui_3) EndFunc Edited September 17, 2005 by Dickb Link to comment Share on other sites More sharing options...
Holger Posted September 17, 2005 Share Posted September 17, 2005 Cause you deleted the 'current gui' you have to select the next current gui (cause there are still more than 1) with "GUISwitch()". Try this: expandcollapse popup#include <GUIConstants.au3> Opt("MustDeclareVars", 1) Global $Gui_1, $Gui_2, $Gui_3; <- Main() Exit Func Main() Local $List, $Done, $msg1 $Gui_1 = GuiCreate("Main", 200, 50) $List = GuiCtrlCreateButton("List", 10, 10, 80, 30) $Done = GuiCtrlCreateButton("Done", 100, 10, 80, 30) GuiSetState(@SW_SHOW) While 1 $msg1 = GuiGetMsg() Select Case $msg1 = $GUI_EVENT_CLOSE ExitLoop Case $msg1 = $Done ExitLoop Case $msg1 = $List List() EndSelect WEnd EndFunc Func Update() Local $Done, $msg2 $Gui_2 = GuiCreate("Update", 200, 50) $Done = GuiCtrlCreateButton("Done", 10, 10, 80, 30) GuiSetState(@SW_SHOW) While 1 $msg2 = GuiGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE ExitLoop Case $msg2 = $Done ExitLoop EndSelect WEnd GUIDelete($Gui_2) GUISwitch($Gui_3); <- this or next line ;GuiSetState(@SW_SHOW, $Gui_3) EndFunc Func List() Local $listview, $Update, $Add, $Done, $msg3 $Gui_3 = GuiCreate("GroupList", 400, 200) $listview = GuiCtrlCreateListView("col1|col2|col3", 0, 0, 400, 150, -1, $LVS_EX_GRIDLINES) GUICtrlCreateListViewItem("line1|data1|more1", $listview) $Update = GuiCtrlCreateButton("Update", 10, 160, 80, 30) $Add = GuiCtrlCreateButton("Add", 100, 160, 80, 30) $Done = GuiCtrlCreateButton("Done", 200, 160, 80, 30) GuiSetState(@SW_SHOW) While 1 $msg3 = GuiGetMsg() Select Case $msg3 = $GUI_EVENT_CLOSE ExitLoop Case $msg3 = $Done ExitLoop Case $msg3 = $Update Update() Case $msg3 = $Add GUICtrlCreateListViewItem("line2|data2|more2", $listview) EndSelect WEnd GUIDelete($Gui_3) EndFunc Regards Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
Dickb Posted September 17, 2005 Author Share Posted September 17, 2005 Oops, you are right. Thanks. 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