Context menu popup on treeview node returning wrong selected node

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Claire

    Context menu popup on treeview node returning wrong selected node

    I've a treeview control containing a root node with several children on a
    windows form.
    I select a node with a left mouse button click.
    I then select one of the other nodes with right mouse click to bring up my
    context menu. The Popup event of this enables menu items depending on the
    node selected.
    The new node highlights, and my context menu pops up but I noticed that the
    enabled state of the menu items was incorrect.
    Tracing into my treecontextmenu _popup event the tree.selectedno de is wrongly
    shown to be the old node and not the new one. But the new one is
    highlighted.
    Has anyone got a solution to this please?

    (Hideselection = false. Hottracking = false, drawmode=normal )


  • TheSteph

    #2
    Re: Context menu popup on treeview node returning wrong selected node

    You have to manually select the node when right-clicking it and before
    showing your popmenu; even if this node SEEMS to be already selected by your
    right-click.

    Steph.


    "Claire" <claire@nospam. comwrote in message
    news:OAbKYpwXHH A.688@TK2MSFTNG P03.phx.gbl...
    I've a treeview control containing a root node with several children on a
    windows form.
    I select a node with a left mouse button click.
    I then select one of the other nodes with right mouse click to bring up my
    context menu. The Popup event of this enables menu items depending on the
    node selected.
    The new node highlights, and my context menu pops up but I noticed that
    the
    enabled state of the menu items was incorrect.
    Tracing into my treecontextmenu _popup event the tree.selectedno de is
    wrongly
    shown to be the old node and not the new one. But the new one is
    highlighted.
    Has anyone got a solution to this please?
    >
    (Hideselection = false. Hottracking = false, drawmode=normal )
    >
    >

    Comment

    • Claire

      #3
      Re: Context menu popup on treeview node returning wrong selected node

      Thanks Steph,
      yes I've had to add code in the node onclick event to set the selected node
      and it now works as I expected.

      "TheSteph" <TheSteph@NoSpa m.comwrote in message
      news:egiE3UxXHH A.1240@TK2MSFTN GP04.phx.gbl...
      You have to manually select the node when right-clicking it and before
      showing your popmenu; even if this node SEEMS to be already selected by
      your
      right-click.
      >
      Steph.
      >


      Comment

      Working...