koresho Posted May 25, 2010 Share Posted May 25, 2010 (edited) I've discovered another way to do this that works correctly. Sorry for the post, I guess I posted too soon. Mods, please feel free to delete this topic; if I could I would =/Hey everyone, I'm having an issue with my TreeView not getting a context menu applied to it. I think it may have something to do with using a UDF to create the TreeView, but I'm not sure. I'm trying to make it where you can right-click on a TreeView item and Delete/Add/Rename files. My code below works to create a context menu for the ListView item, but not for the TreeView... Any help is appreciated. If possible, I'd like to continue using the UDF to create the treeview, as otherwise other parts of my script that use the UDF aren't able to update the treeview information (_GUICtrlTreeView_DeleteChildren and _GUICtrlTreeView_AddChild, specifically)Thanks in advance!$ftpGui = GUICreate($version & " - Connected", 620, 400, -1, -1) $conStat2 = GUICtrlCreateLabel("Populating files...", 10, 12, 600, 20, $SS_CENTER) $fListV = GUICtrlCreateListView("Filename|Attributes|File Size", 140, 40, 470, 300, $LVS_SORTASCENDING, $LVS_EX_FULLROWSELECT + $LVS_EX_TWOCLICKACTIVATE, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetColumnWidth($fListV, 0, 300) _GUICtrlListView_SetColumnWidth($fListV, 2, $LVSCW_AUTOSIZE_USEHEADER) $fTreeV = _GUICtrlTreeView_Create($ftpGui, 10, 40, 120, 300, -1, $WS_EX_CLIENTEDGE) $fTreeVk = _GUICtrlTreeView_Add($fTreeV, "", $kNum) ;$kNum is defined elsewhere _GUICtrlTreeView_SetSelected($fTreeV, $fTreeVk) _GUICtrlTreeView_SetBold($fTreeV, $fTreeVk) $refresh = GUICtrlCreateButton("&Refresh", 10, 350, 50, 30) $cFolder = GUICtrlCreateButton("&Create Folder", 60, 350, 80, 30) $dlFiles = GUICtrlCreateButton("&Download File", 140, 350, 100, 30) $ulFiles = GUICtrlCreateButton("&Upload File", 240, 350, 80, 30) $tMenu = GUICtrlCreateContextMenu($fTreeV) ;Create context for the folder list $tMcreate = GUICtrlCreateMenuItem("Create Folder", $tMenu) $tMdelete = GUICtrlCreateMenuItem("Delete Folder", $tMenu) $tMrename = GUICtrlCreateMenuItem("Rename Folder", $tMenu) GUICtrlCreateMenuItem("", $tMenu) $tMul = GUICtrlCreateMenuItem("Upload Folder", $tMenu) $tMdl = GUICtrlCreateMenuItem("Download Folder", $tMenu) GUICtrlCreateMenuItem("", $tMenu) $tRefresh = GUICtrlCreateMenuItem("Refresh View", $tMenu) $lMenu = GUICtrlCreateContextMenu($fListV) ;Create context for the file list $lMcreate = GUICtrlCreateMenuItem("Create File", $lMenu) $lMdelete = GUICtrlCreateMenuItem("Delete File", $lMenu) $lMrename = GUICtrlCreateMenuItem("Rename File", $lMenu) GUICtrlCreateMenuItem("", $lMenu) $lMul = GUICtrlCreateMenuItem("Upload File", $lMenu) $lMdl = GUICtrlCreateMenuItem("Download File", $lMenu) GUICtrlCreateMenuItem("", $lMenu) $lRefresh = GUICtrlCreateMenuItem("Refresh View", $lMenu) GUISetState() Edited May 25, 2010 by koresho 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