Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29382 Discussions

Highlight TreeView Item on right click

ratzeputz
Beginner
648 Views
Hi there its me again :)
Does anyone know, if there is a way to set an item of a TreeView to highlited state, if the item was clicked with the right mousebutton?
Finding out, which item was selected, firing a ContextMenu and so on, i already done.
My problem is, that after the routines in the ContextMen are done, the highlightbar jumps back to the item, where it was before.
On left click, the highlight bar stays on the new selected item.
Tried it already with a bit "dirty hacking" and just coded a simulation of the leftclick on the same position where the right click has been done. The left click event is fired on the treeview and its acting like it should, but the highlight bar also going back to the item where it was before then.
Any suggestions?
Best Regards
Oliver
0 Kudos
1 Reply
ratzeputz
Beginner
648 Views
I found an answer by myself.
only this SendMessage did work
[fortran]retlog = SendMessage(hwnd_tree, TVM_SELECTITEM , TVGN_DROPHILITE, sel_item_ID)[/fortran]
the problem was, that there have to be a "second eventcircle" (dont know how to describe it better) after i performed the contextmenu and the operations.
circle 1 (hook up rightclick, simulating left click)
circle 2 (collecting item information and do specific code...store selected item id)
circle 3 (above sendmessage)
quite not elegant, but performance is good and works like a charm.
any other suggestions of a more better way are welcomed :)
Best Regards
Oliver
0 Kudos
Reply