Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Selecting a tree node??

Selecting a tree node??

Scheduled Pinned Locked Moved C#
data-structuresquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Muammar
    wrote on last edited by
    #1

    Good evening truly people, With all due respect, may I know how HOW THE HELL do I get a node selected using the right mouse button and then show the context menu.. I'm trying this

    private void tree_Level_MouseDown(object sender, MouseEventArgs e)
    {
    tree_Level1.GetChildAtPoint(tree_Level.PointToClient(new Point(e.X, e.Y)).Select();
    }

    Then I managed to show the context menu but once that happens, it goes back and selects the old node:confused:


    Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

    P A 2 Replies Last reply
    0
    • M Muammar

      Good evening truly people, With all due respect, may I know how HOW THE HELL do I get a node selected using the right mouse button and then show the context menu.. I'm trying this

      private void tree_Level_MouseDown(object sender, MouseEventArgs e)
      {
      tree_Level1.GetChildAtPoint(tree_Level.PointToClient(new Point(e.X, e.Y)).Select();
      }

      Then I managed to show the context menu but once that happens, it goes back and selects the old node:confused:


      Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Use the AfterSelect event instead.

      Deja View - the feeling that you've seen this post before.

      M 1 Reply Last reply
      0
      • P Pete OHanlon

        Use the AfterSelect event instead.

        Deja View - the feeling that you've seen this post before.

        M Offline
        M Offline
        Muammar
        wrote on last edited by
        #3

        Hi Pete and thanks for the help.. Actually, it was already in the AfterSelect event and I had to move it to obtain the mouse location value form the passed arguments. If you tried to run the piece of code I just pasted, it will simply not work anywhere not just out of the AfterSelect event!


        Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

        1 Reply Last reply
        0
        • M Muammar

          Good evening truly people, With all due respect, may I know how HOW THE HELL do I get a node selected using the right mouse button and then show the context menu.. I'm trying this

          private void tree_Level_MouseDown(object sender, MouseEventArgs e)
          {
          tree_Level1.GetChildAtPoint(tree_Level.PointToClient(new Point(e.X, e.Y)).Select();
          }

          Then I managed to show the context menu but once that happens, it goes back and selects the old node:confused:


          Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

          A Offline
          A Offline
          Abisodun
          wrote on last edited by
          #4

          In the NodeMouseClick event: treeview.SelectedNode = treeview.GetNodeAt(e.Location);

          M 1 Reply Last reply
          0
          • A Abisodun

            In the NodeMouseClick event: treeview.SelectedNode = treeview.GetNodeAt(e.Location);

            M Offline
            M Offline
            Muammar
            wrote on last edited by
            #5

            Hey! Thanx a bunch buddy, that was a great help!


            Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

            A 1 Reply Last reply
            0
            • M Muammar

              Hey! Thanx a bunch buddy, that was a great help!


              Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

              A Offline
              A Offline
              Abisodun
              wrote on last edited by
              #6

              No problem

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups