treeview ctrl rmb menu question
-
I have recently written a 'project browser' ctrl for my hobby ide BUT when i right click on an item to 'select item and show menu' even though the carat is on the new item the control reports the active TREEVIEWITEM is the previously selected item and the menu acts on the prev selected item. With listboxes its easy you just subclass the ctrl and simulate "press lmb down and lmb up" when rmb is pressed but this method doesnt work at all with treeviews. How do i select a item with the rmb? Ps. you can be technical with your responce, im v.familiar w/ winapi. :) thx bob Sorry guys lol. Just solved it. You use the TVM_HITTEST to get the current item under the mouse cursor then call TVM_SELECTITEM w/ that item. Then call trackpopupmenu as normal. 4 hours wasted last night on that one... still happy ending. ;)
-
I have recently written a 'project browser' ctrl for my hobby ide BUT when i right click on an item to 'select item and show menu' even though the carat is on the new item the control reports the active TREEVIEWITEM is the previously selected item and the menu acts on the prev selected item. With listboxes its easy you just subclass the ctrl and simulate "press lmb down and lmb up" when rmb is pressed but this method doesnt work at all with treeviews. How do i select a item with the rmb? Ps. you can be technical with your responce, im v.familiar w/ winapi. :) thx bob Sorry guys lol. Just solved it. You use the TVM_HITTEST to get the current item under the mouse cursor then call TVM_SELECTITEM w/ that item. Then call trackpopupmenu as normal. 4 hours wasted last night on that one... still happy ending. ;)