NewKreation Posted January 14, 2005 Share Posted January 14, 2005 Please have a look at the code below. :"> The right list box is being deleted and populated correctly until...the about dialog box is pulled up and closed. Now the right list box just disappears! expandcollapse popup#include <GUIConstants.au3> ; Must include for GUI functions to work $parentgui = GUICreate ("Main", 280, 105) ; will create the main program window $helpmenu = GUICtrlCreateMenu ("&Help") $aboutitem = GUICtrlCreateMenuitem ("&About",$helpmenu) GUISetState () ; will display the main program window Global $List1 = GUICtrlCreateList ("", 10, 15, 120, 80) GUICtrlSetData ($List1, "item1|item2|item3") Global $leftlist = GUICtrlRead ($List1) Global $List2 = GUICtrlCreateList ("", 150, 15, 120, 80) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg (1) $ctrlmsg = $msg[0] $win = $msg[1] $_leftlist = GUICtrlRead ($List1) Select Case $ctrlmsg = $GUI_EVENT_CLOSE AND $win = $parentgui ExitLoop Case $ctrlmsg = $GUI_EVENT_CLOSE AND $win = $childgui GUISwitch ($parentgui) GUISetState (@SW_ENABLE) GUISwitch ($childgui) GUISetState (@SW_HIDE) Case $ctrlmsg = $aboutitem $winpos = WinGetPos ("Main") $childgui = GUICreate ("About", 260, 85, $winpos[0] + 10, $winpos[1] + 10, BitOr ($WS_POPUP, $WS_CAPTION, $WS_SYSMENU), -1, $parentgui) GUISetState (@SW_SHOW) GUICtrlCreateLabel ("Program Version 0.1.0" & chr(10) & chr(10) & "Copyright " & chr(169) & " 2005 Inc.", 62, 10, 150, 75, $SS_CENTER) GUISetState (@SW_ENABLE) GUISwitch ($parentgui) GUISetState (@SW_DISABLE) Case $leftlist <> $_leftlist $leftlist = GUICtrlRead ($List1) GUICtrlDelete ($List2) Global $List2 = GUICtrlCreateList ("", 150, 15, 120, 80) If $leftlist = "item1" Then GUICtrlSetData ($List2, "item10|item11|item13") If $leftlist = "item2" Then GUICtrlSetData ($List2, "item20|item21|item23") If $leftlist = "item3" Then GUICtrlSetData ($List2, "item30|item31|item33") EndSelect Wend GUIDelete () Exit Link to comment Share on other sites More sharing options...
Josbe Posted January 14, 2005 Share Posted January 14, 2005 (edited) Check the slight changes...really the script had two unnecessary lines. (Check the comments in "Case $leftlist <> $_leftlist" block)expandcollapse popup#include <GUIConstants.au3> ; Must include for GUI functions to work $parentgui = GUICreate ("Main", 280, 105); will create the main program window $helpmenu = GUICtrlCreateMenu ("&Help") $aboutitem = GUICtrlCreateMenuitem ("&About",$helpmenu) GUISetState (); will display the main program window Global $List1 = GUICtrlCreateList ("", 10, 15, 120, 80) GUICtrlSetData ($List1, "item1|item2|item3") Global $leftlist = GUICtrlRead ($List1) Global $List2 = GUICtrlCreateList ("", 150, 15, 120, 80) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg (1) $ctrlmsg = $msg[0] $win = $msg[1] $_leftlist = GUICtrlRead ($List1) Select Case $ctrlmsg = $GUI_EVENT_CLOSE AND $win = $parentgui ExitLoop Case $ctrlmsg = $GUI_EVENT_CLOSE AND $win = $childgui GUISwitch ($parentgui) GUISetState (@SW_ENABLE) GUISwitch ($childgui) GUISetState (@SW_HIDE) Case $ctrlmsg = $aboutitem $winpos = WinGetPos ("Main") $childgui = GUICreate ("About", 260, 85, $winpos[0] + 10, $winpos[1] + 10, BitOr ($WS_POPUP, $WS_CAPTION, $WS_SYSMENU), -1, $parentgui) GUISetState (@SW_SHOW) GUICtrlCreateLabel ("Program Version 0.1.0" & chr(10) & chr(10) & "Copyright " & chr(169) & " 2005 Inc.", 62, 10, 150, 75, $SS_CENTER) GUISetState (@SW_ENABLE) GUISwitch ($parentgui) GUISetState (@SW_DISABLE) Case $leftlist <> $_leftlist $leftlist = GUICtrlRead ($List1) ;GUICtrlDelete ($List2);unnecessary line (deletion) ;Global $List2 = GUICtrlCreateList ("", 150, 15, 120, 80);unnecessary line GUICtrlSetData ($List2, "") If $leftlist = "item1" Then GUICtrlSetData ($List2, "item10|item11|item13") If $leftlist = "item2" Then GUICtrlSetData ($List2, "item20|item21|item23") If $leftlist = "item3" Then GUICtrlSetData ($List2, "item30|item31|item33") EndSelect Wend GUIDelete () ExitEdit: typos Edited January 14, 2005 by josbe AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
NewKreation Posted January 14, 2005 Author Share Posted January 14, 2005 Check the slight changes...really the script had two unnecessary lines. (Check the comments in "Case $leftlist <> $_leftlist" block)That's it! Oh man do I feel silly on one hand and slap happy on the other.Josbe, you deserve the rest of the day off Thanks a billion! 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