#include #include #include #include #include "GUIListViewEx.au3" #include Global $List1, $sString, $hButton0, $iLV_Index gui1() Func gui1() $hGUI1 = GUICreate("Gui 1", 400, 400, 200, 200) $hButton0 = GUICtrlCreateButton("Load", 100, 10, 80, 30) $hButton1 = GUICtrlCreateButton("Clear 1", 10, 10, 80, 30) $hButton2 = GUICtrlCreateButton("Edit", 10, 60, 80, 30) $List1 = GUICtrlCreateListView("", 10, 100, 180, 80, BitOR(0x0200, 0x008), BitOR(0x00000020, 0x00000001)) _GUICtrlListView_AddColumn($List1, "1", 150, 2) _GUICtrlListView_AddColumn($List1, "2", 500, 2) _GUICtrlListView_AddColumn($List1, "3", 50, 2) _GUICtrlListView_Scroll($List1, 10, 100) ; Initiate ListView within UDF $iLV_Index = _GUIListViewEx_Init($List1, "") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton1 MsgBox("", "MsgBox 1", "Clear???") _GUICtrlListView_DeleteAllItems($List1) Case $hButton2 ; Disable the first GUI GUISetState(@SW_DISABLE, $hGUI1) gui2() ; Re-enable the first GUI GUISetState(@SW_ENABLE, $hGUI1) Case $hButton0 _GUIListViewEx_LoadListView($iLV_Index, "Save.lvs") ; Reset column alignment _GUICtrlListView_JustifyColumn($List1, 0, 2) _GUICtrlListView_JustifyColumn($List1, 1, 2) _GUICtrlListView_JustifyColumn($List1, 2, 2) _WinAPI_RedrawWindow(GUICtrlGetHandle($List1)) EndSwitch WEnd EndFunc ;==>gui1 Func gui2() $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350) $sString = GUICtrlCreateEdit("", 50, 50, 100, 100, $ES_WANTRETURN) $hButton3 = GUICtrlCreateButton("Save", 10, 10, 80, 30) GUISetState() While 1 ; We can only get messages from the second GUI Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton3 $sRead1 = GUICtrlRead($sString) _GUIListViewEx_Insert($sRead1 & "||") ; Add item to ListView uaing UDF _GUIListViewEx_SaveListView($iLV_Index, "Save.lvs") GUICtrlSetState($hButton0, $GUI_ENABLE) ExitLoop EndSwitch WEnd GUIDelete($hGUI2) EndFunc ;==>gui2