grham Posted December 21, 2006 Share Posted December 21, 2006 Hello, I'm finding a strange? behaviour of a context menu. My script creates a gui and a listview with its contextmenu OK Now I decided not to show the list view on the start of the gui because there are to meny items and its your choise to create it or do anything else and create it later ...... but when the gui starts the next time, GuiGetMsg "detects" a click on "a subitem" and tries to preform the before defined action. But there's no context menu and no listview yet. I tried to delete the gui, delete the menu and it's subitems, restart it and again The above mentioned action is only asociated to this menusubitem. Anything else in the script functione well. When I create the list view on the start (no mather if with items or not) the problem does not appeare. Is it a possible bug? I use the beta version -..... 13 Thanks for a response Link to comment Share on other sites More sharing options...
grham Posted December 21, 2006 Author Share Posted December 21, 2006 A simple example: #include <GUIConstants.au3> #include <GuiListView.au3> Dim $Context_NewLine GUICreate("Prueba" ,680,460,-1,-1, $WS_OVERLAPPEDWINDOW) GUISetBkColor (0x00E0FFFF) ;-------------------------------------------------------- ;First run it as is, the second time after commenting the following section ;--------------------------------------------------------- ;#comments-start $listview = GUICtrlCreateListView ("Linia |Grupo |Disco |N°CD ",10,60,540,380,BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_REGIONAL)) $ContextMenu = GUICtrlCreateContextMenu($listview) $Context_NewLine = GUICtrlCreateMenuitem ("Nueva linia",$ContextMenu) $Context_Separator1 = GUICtrlCreateMenuitem ("",$ContextMenu) $Context_DeleteLine = GUICtrlCreateMenuitem ("Borrar linia",$ContextMenu) #comments-end GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Context_NewLine MsgBox(1, "Info", "New line") EndSelect WEnd Link to comment Share on other sites More sharing options...
grham Posted December 21, 2006 Author Share Posted December 21, 2006 A simple example:#include <GUIConstants.au3>#include <GuiListView.au3>Dim $Context_NewLineGUICreate("Prueba" ,680,460,-1,-1, $WS_OVERLAPPEDWINDOW)GUISetBkColor (0x00E0FFFF);--------------------------------------------------------;First run it as is, the second time after commenting the following section;---------------------------------------------------------;#comments-start$listview = GUICtrlCreateListView ("Linia |Grupo |Disco ",10,60,540,380,BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_REGIONAL))$ContextMenu = GUICtrlCreateContextMenu($listview)$Context_NewLine = GUICtrlCreateMenuitem ("Nueva linia",$ContextMenu)$Context_Separator1 = GUICtrlCreateMenuitem ("",$ContextMenu)$Context_DeleteLine = GUICtrlCreateMenuitem ("Borrar linia",$ContextMenu)#comments-endGUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE #comments-start GuiCtrlDelete($Context_NewLine) GuiCtrlDelete($Context_DeleteLine) GuiCtrlDelete($Context_Separator1) GuiCtrlDelete($ContextMenu) GuiCtrlDelete($listview) GuiDelete() #comments-end Exit Case $msg = $Context_NewLine MsgBox(1, "Info", "New line") EndSelectWEnd Link to comment Share on other sites More sharing options...
GaryFrost Posted December 21, 2006 Share Posted December 21, 2006 use code tags with code makes it easier to read just set Dim $Context_NewLine = -999 or something that the msg shouldn't default to by not setting it to anything, it is 0, default return when nothing is happening for GuiGetMsg is 0 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...
grham Posted December 21, 2006 Author Share Posted December 21, 2006 use code tags with code makes it easier to read just set Dim $Context_NewLine = -999 or something that the msg shouldn't default to by not setting it to anything, it is 0, default return when nothing is happening for GuiGetMsg is 0 Super Gary Thank You! After setting a value for each menu subitem it's working. 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