Errol Posted February 7, 2008 Share Posted February 7, 2008 Hello all, I'm hoping this isn't a bug and is just my lack of understanding of events, but after an hour of debugging, I can't figure this out. I am making an editor for some XML config files of mine, and I was done. It was working as planned until I ran into this weird bug. I'm using a Listview control, and I wanted to move each row up and down with ease, as well as add, delete and copy. So I made five buttons and attached the proper events to these controls (Lines #113 - #140). They worked fine and dandy with no problem. But when I select row items in the ListView control, it starts executing the functions that are tied only to the buttons. So I may click the fifth row in the listview control, and it will run the _List_Up() event, which moves a row up. Or, I'll click the last row, and it runs the _List_Add() event. Lines #324 - #335 contain the code which executes when you click in the ListView control. There is nothing there that I can see that would execute those functions. These buttons are not necessary, they just make things more user friendly. I could move them to a menu, or a hotkey, but I'd also like to keep them to the buttons. Anyone have any ideas? Thank you very much! P.S. This is a slightly smaller version of the real one. The original one has all the XML coding in it, but I didn't want anyone to add another dependency, and the problem still replicates without it. So don't use the file menu. [autoit]; - PROGRAM INFORMATION ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.2.10.0 ; Author: Errol Elumir ; ; Script Function: ; Configure Tutorial XML File ; ; - PROGRAM INFORMATION ---------------------------------------------------------------------------- #region INCLUDES AND OPTIONS Opt('MustDeclareVars', 1) Opt("GuiOnEventMode", 1) Opt("ColorMode",0) #include <GuiListView.au3> #include <GuiMenu.au3> #include <GuiStatusBar.au3> #endregion INCLUDES AND OPTIONS #region GLOBALS Global $Title = "Gamemaker Tutorial Editor" Global $ListView, $GUI ; GUI ID's Global $hStatus, $hProgress, $hListView, _ ; GUI Handles $dGUI, $dPath, $dProgram, $dShort, $dEXE, $dReg ; GUI Dialogue Variables Global $Type_Combo ; GUI Dialogue Input IDs Global $Type_List = "|info|do|do_click|wait|save|quiz|chapter" Global $Vis_Radio1, $Vis_Radio2, $Vis_Radio3, $Vis_Group, _ $Trans_Input1, $Text_Input1, $Pos_Combo1, _ $Command_Group, $Command_Label, $Command_Input1, _ $Quiz_Group, $Answer_Group, _ $Param_Input1, $Voice_Input1, $Voice_Label, $Dir_Button Global Enum $L_Typ = 1, $L_Vis,$L_Cmd,$L_Par,$L_Snd,$L_Pos,$L_Txt,$L_Cor,$L_AN1,$L_AN2,$L_AN3,$L_AN4 ; Index of Sub Items in Listview Global Enum $idNew = 1000, $idOpen, $idSave, $idSaveAs, $idExit, _ ; Menu Controls $idCut, $idCopy, $idPaste, $idAbout ;Global Enum $subProgram = 1, $subShort,$subPath, $subEXE, $subReg ; Index of Sub Items in Listview Global $debug_num = 0 ; For debugging purposes Global $XMLFile ; eventually make it from Open, but this is default one Global $filter_typ, $filter_vis, $filter_cmd, $filter_pos, $filter_txt, $filter_qui ; listview filters Global $list_up, $list_down, $list_add, $list_del, $list_copy ; Buttons for manipulating list Global $listview_selected = -1 ; Selected in listview ; Globals for getting custom colours in listview Global Const $tagNMLVCUSTOMDRAW = "hwnd hWndFrom;int IDFrom;int Code;dword dwDrawStage;hwnd hdc;int Left;int Top;int Right;int Bottom;" & _ "dword dwItemSpec;uint uItemState;long lItemlParam;int clrText;int clrTextBk;int iSubItem;dword dwItemType;int clrFace;int iIconEffect;" & _ "int iIconPhase;int iPartId;int iStateId;int TextLeft;int TextTop;int TextRight;int TextBottom;uint uAlign" Global Const $CDDS_PREPAINT = 0x00000001 Global Const $CDDS_ITEMPREPAINT = 0x00010001 Global Const $CDRF_NEWFONT = 0x00000002 Global Const $CDRF_NOTIFYITEMDRAW = 0x00000020 Global Const $TEXT_GROUP_NORMAL = "Text to display - Indicate position" Global Const $TEXT_GROUP_CHAPTER = "Chapter Title" Global Const $TEXT_GROUP_QUESTION = "Question" Global Const $MASK_FULL = 31 ; 11111 Global Const $MASK_LIST_UP = 16 ; 10000 Global Const $MASK_LIST_DOWN = 8 ; 01000 Global Const $MASK_LIST_ADD = 4 ; 00100 Global Const $MASK_LIST_DEL = 2 ; 00010 Global Const $MASK_LIST_COPY = 1 ; 00001 #endregion GLOBALS ; Main Program _Main() #region MAIN & EVENT FUNCTIONS Func _Main() Local $hFile, $hMain ; GUI Variables Local $a_PartsText[2] = ["", ""], $a_PartsRightEdge[2] = [400, -1] ; Statusbar Variables ; MAIN GUI ; -------------------------------- $GUI = GUICreate($Title, 795, 600, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU, $WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX)) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Resize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "_Resize") GUISetOnEvent($GUI_EVENT_RESIZED, "_Resize") GUISetOnEvent($GUI_EVENT_RESTORE, "_Resize") ; Create Menu ;--------------------------------- $hFile = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew) _GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen) _GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave) _GUICtrlMenu_InsertMenuItem ($hFile, 3, "Save&As", $idSaveAs) _GUICtrlMenu_InsertMenuItem ($hFile, 4, "", 0) _GUICtrlMenu_InsertMenuItem ($hFile, 5, "E&xit", $idExit) ; Create Main menu $hMain = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile) ;_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit) ;_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp) ; Set window menu _GUICtrlMenu_SetMenu ($GUI, $hMain) GUISetState() ; Define StatusView ;--------------------------------- $hStatus =_GUICtrlStatusBar_Create($GUI, $a_PartsRightEdge, $a_PartsText, $SBT_TOOLTIPS) _GUICtrlStatusBar_SetMinHeight($hStatus, 15) GUICtrlSetResizing(-1, $GUI_DOCKSTATEBAR) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) $hProgress = GUICtrlCreateProgress(180, 2, 610, 16) GUICtrlSetState($hProgress,$GUI_HIDE) GUICtrlSetResizing (-1,$GUI_DOCKRIGHT+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT+$GUI_DOCKTOP) ; Listview Controls Local $x_offset = 5 Local $y_value = 2 $list_up = GUICtrlCreateButton("p", $x_offset, $y_value, 16, 16, $WS_CLIPSIBLINGS) ; Up GUICtrlSetFont (-1,8.5, 400, 0, "Wingdings 3") GUICtrlSetState (-1,$GUI_DISABLE) GUICtrlSetResizing (-1,$GUI_DOCKLEFT+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT+$GUI_DOCKTOP) GUICtrlSetOnEvent($list_up, "_List_Up") $list_down = GUICtrlCreateButton("q", $x_offset + 20, $y_value, 16, 16, $WS_CLIPSIBLINGS) ; Down GUICtrlSetFont (-1,8.5, 400, 0, "Wingdings 3") GUICtrlSetState (-1,$GUI_DISABLE) GUICtrlSetResizing (-1,$GUI_DOCKLEFT+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT+$GUI_DOCKTOP) GUICtrlSetOnEvent($list_down, "_List_Down") $list_add = GUICtrlCreateButton(" Link to comment Share on other sites More sharing options...
GaryFrost Posted February 7, 2008 Share Posted February 7, 2008 Check bug reports fixed you'll find it was fixed in 3.2.11.0 beta, also posted a quick fix for those that don't want to go to beta. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Errol Posted February 8, 2008 Author Share Posted February 8, 2008 Check bug reports fixed you'll find it was fixed in 3.2.11.0 beta, also posted a quick fix for those that don't want to go to beta.Great!Thank you so much! 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