Tree control: Selecting an item by right clicking on it

2012-04-19  Source: Original Site  Category:Visual C++  Views:0 


This is what I have:
I have a window split into 2 panes. One displays a tree of modules (classes), implemented using a CTreeCtrl. The other pane displays a list of variables belonging to the selected module in the tree.

This is what I want to do:
When a user right clicks with the mouse on a tree item,
- If the item is not selected, everything that occurs when it is left clicked should occur, except that the background (or text color) of the item should be colored differently.
- If the item is already selected, is background should be set back to the background of a normally selected item.

My main problems:
- How do I select an item by right clicking it?
- How do I catch the selection of an item that is already selected?

I hope I’m clear enough.
Any help would be appreciated,

Related articles
  • Tree control: Selecting an item by right clicking on it 2012-04-19

    This is what I have: I have a window split into 2 panes. One displays a tree of modules (classes), implemented using a CTreeCtrl. The other pane displays a list of variables belonging to the selected module in the tree. This is what I want to do: Whe

  • Selecting TreeView Item with Right Click 2013-12-06

    I have a TreeView Control and an event handler for the MouseUp event. The handler is supposed to dynamically create a context menu based on the selected item. However, I want it to select the item that was right clicked if it is not already. When I r

  • Tree Control select method called itself 2014-11-09

    I have tree control on left pane and list control on right pane. For list control i'm displaying a pop up menu when i right click on any item in list control. When i right click on any item in list control and select any option from pop menu, tree co

  • Ubuntu How To Change The Items In right click menu ? 2012-10-03

    Im new to ubuntu .. and i dont know if this the right place to ask . i want to change items in right click menu.. that is , when u right click , u will get Create Folder , Create Launcher. etc. i want to know how to change that .

  • Ubuntu Cannot 'control-select' multiple items 2014-09-25

    I cannot seem to control select multiple items in Nautilus file browser or on my desktop. I am running Intrepid Ibex.

  • Tree Control Selection Problem 2012-07-28

    I am having a problem getting the selected Item in my tree control I am right clicking on an item and getting a pop up window. I select an item from the menu and want to insert an item after that node. The problem is if I right click the Item I am no

  • Multi Tree Control Selection for a Context menu 2013-06-12

    Has anyone attempted to select muliple items in a tree control and do a right mouse click to display a pop-up menu. When I do, only one item stays highlighted. Does anyone know how to keep all items highlighted for a right mouse click?

  • CFileDialog crashes when item is right-clicked 2012-05-15

    Here is the function containing the code to launch a typical CFileDialog: void CMFCTestView::OnBnClickedButtonBrowse() { TCHAR tcFilter[]=_T("Excel (*.xls)|*.xls||"); CFileDialog cfddlg(TRUE, _T("xls"), _T("*.xls"), OFN_FILEMUSTEXIST | !OFN_NONETWORK

  • Tree Control Selections?? 2012-12-24

    I have a tree control that is dynamically created on a dialog box. When you select an item, the highlight color moves to the new item, but the selection rectangle stays on the old one until the mouse key is released. If you are trying to select a new

  • Ubuntu adding item to right-click menu 2012-03-19

    Greetings all... I'm using a pretty standard Warty install with Gnome. I woud like to add an item to the context menu that pops up when you right click on a desktop item. Specifically, I want to add an "eject" command to the context menu of the ipod

  • Move down through a Tree Control getting every item text 2012-08-10

    I want to move through a Tree Control getting the text of all items. I don´t know anything about the depth of the tree or it´s structure. I just want to start at the root and get the handle of every item, one by one. Example: Root | |----Pa | |----So

  • Ubuntu Adding Items to right Click menu? 2013-06-23

    hi, I just updated to breezy from hoary, and noticed that the "open terminal" menu item is gone from the right click. I was just wondering if there was a way, and if so how to, add that, and other items into the right click menu? Thank you for your t

  • How add menu item in right-click menu of Windows Explorer 2014-07-15

    I want to add a menu item in Windows Explorer's right-click menu, how can I do?

  • Ubuntu Remove items from right click menu 2014-11-11

    i would like to remove s#certain items from the right click menu in ubuntu 10.04 i.e. remove functions from the right click menu in 10.04

  • Selecting tabpage when you right click it.. 2014-12-10

    My program requires users to be able to right click a tab and then close it, but I can't do this when the right clicked tab doesn't select. Any help would be nice,

  • Ubuntu Remove Panel Item when RIGHT CLICK doesn't work 2015-01-10

    I recently installed a "menu file browser" applet on my main panel. I now want to remove it but the right click button does not work on this item. Is there a manual way to do this?

  • adding an item to right click menu... 2015-02-18

    guys, i'm new to this forum.well my problem is this. i developed an encryption alg. in c++.Now i wanna know if i could add a item to the menu when i right click a file.i need to execute the cpp prog when i click that item.

  • Ubuntu Add items to right click menu in nautilus 2014-05-12

    I want to be able to right click an mp3 file or a folder containing mp3s in nautilus and have as an option 'Enqueue in beep-media-player'. I'm aware I can make a script that will add the option to a sub-menu, but I'd really like it right there above

  • Replacing Item In Right-Click Menu 2016-01-03

    How can I replace the right-click > new > text document to create a new notepad text file? Running Windows XP Professional.

  • Oracle Using a tree for selecting an item 2012-04-23

    Sorry if my lingo is not the best but what I am trying to do is to use a tree to make a selection for a DBA report. That is selecting a client then project and then a server. Once this is selected then I can fill out details about what was done to th