Ebenezer Posted March 21, 2006 Posted March 21, 2006 Hi, In my GUI I use a function I found on the boards to trigger certain changes changes in the GUI when the user clicks on listview entries. Works like a charm - a big thanks to the author. However when I try to add a second list to the possible trigger the whole thing crashes, stating that $List_3 is not declared. Error: E:\Div\GUI_Auctionhelper.au3 (143) : ==> Variable used without being declared.: Case $wParam = $List_3 Case $wParam = ^ ERROR Working code: ;Main Function for Listclick actions Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $List_1 Select Case $event = $NM_CLICK If _GUICtrlListViewGetItemText ($List_1, _GUICtrlListViewGetSelectedIndices($List_1), 0) == -1 Then _GUICtrlListViewDeleteAllItems($List_2) GUICtrlSetData($Label_11, "<- Select Item ->") GUICtrlSetPos($Label_11, 210, 170, 250, 20) GUICtrlSetState($Input_6, $GUI_HIDE) Else GUICtrlSetData($Label_11, _GUICtrlListViewGetItemText ($List_1, _GUICtrlListViewGetSelectedIndices($List_1), 0)) GUICtrlSetPos($Label_11, 210, 170, 180) GUICtrlSetState($Input_6, $GUI_SHOW) EndIf Case $event = $NM_DBLCLK;~ ListView_DoubleClick () EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events Non-working code: expandcollapse popup;Main Function for Listclick actions Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $List_1 Select Case $event = $NM_CLICK If _GUICtrlListViewGetItemText ($List_1, _GUICtrlListViewGetSelectedIndices($List_1), 0) == -1 Then _GUICtrlListViewDeleteAllItems($List_2) GUICtrlSetData($Label_11, "<- Select Item ->") GUICtrlSetPos($Label_11, 210, 170, 250, 20) GUICtrlSetState($Input_6, $GUI_HIDE) Else GUICtrlSetData($Label_11, _GUICtrlListViewGetItemText ($List_1, _GUICtrlListViewGetSelectedIndices($List_1), 0)) GUICtrlSetPos($Label_11, 210, 170, 180) GUICtrlSetState($Input_6, $GUI_SHOW) EndIf Case $event = $NM_DBLCLK;~ ListView_DoubleClick () EndSelect Case $wParam = $List_3 Select Case $event = $NM_CLICK If _GUICtrlListViewGetItemText ($List_3, _GUICtrlListViewGetSelectedIndices($List_3), 0) == -1 Then _GUICtrlListViewDeleteAllItems($List_3) GUICtrlSetData($Label_11, "<- Select Item ->") GUICtrlSetPos($Label_11, 210, 170, 250, 20) GUICtrlSetState($Input_6, $GUI_HIDE) Else GUICtrlSetData($Label_11, _GUICtrlListViewGetItemText ($List_3, _GUICtrlListViewGetSelectedIndices($List_3), 0)) GUICtrlSetPos($Label_11, 210, 170, 180) GUICtrlSetState($Input_6, $GUI_SHOW) EndIf Case $event = $NM_DBLCLK;~ ListView_DoubleClick () EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events Could anyone please enlighten me ? BTW, is there any place to learn more about the code used here? I could find no info about most of the stuff in there, like "GUIRegisterMsg" or "DllStructCreate". Thanks !
GaryFrost Posted March 21, 2006 Posted March 21, 2006 move the guiregistermsg to just above the guisetstate i.e. ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") GUISetState() SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Ebenezer Posted March 21, 2006 Author Posted March 21, 2006 It works. Thanks a lot! But could you explain to my why it accepted List_1 even though that one too, was defined below it but rejected List_3 even though it was only some 10 lines below in the "same direction". I would have understood if the code hadn't worked when used before the Lists were declared. But the difference between the two declarations escapes me ...
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