473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to add mouse right-click event to tree w/out overriding defaul

by default when you right click a tree the control selects the node

if you add a right-click event (so that I can put sepearate ContextMenus
depending on what type of node the user clicked on) then that default
behavior is overrided, and it no longer selects the node the user
right-clicked on. Now my event is wrong because I want to use SelectedNode
but the SelectedNode turns out to be whatever was previously selected instead
of what the user just clicked on.

how do I solve this problem?
Oct 26 '06 #1
1 1774
In article <99**********************************@microsoft.co m>,
Mr******@discussions.microsoft.com says...
by default when you right click a tree the control selects the node

if you add a right-click event (so that I can put sepearate ContextMenus
depending on what type of node the user clicked on) then that default
behavior is overrided, and it no longer selects the node the user
right-clicked on. Now my event is wrong because I want to use SelectedNode
but the SelectedNode turns out to be whatever was previously selected instead
of what the user just clicked on.

how do I solve this problem?
Instead of handling the MouseDown event, you could inherit from the
TreeView and override the OnMouseDown method -- and make sure you call
base.OnMouseDown() first to let the base class do it's code first (which
should include selecting the node right-clicked on).

--
Patrick Steele
http://weblogs.asp.net/psteele
Oct 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: scot_nery | last post by:
I got this working in all browsers but FF/NS. It's not picking up the event to find the mouse position. In a perfect world, you mouse over the link and a mouse bubble pops up. Thanks for help....
3
by: Paul L | last post by:
Anyone know a quick way of determining which direction the mouse cursor is moving (ie. up, down, left, right) from a specified origin? Thanks, Paul L
6
by: Carlos García-Carazo | last post by:
Hello, I am working on a C# application for an industrial machine, using Windows Forms, where the user could look at the screen from a 90 degree rotated position, like he could turn the monitor...
1
by: Benny Raymond | last post by:
In my attempt to make a macro recording program where i can then playback mouse movements i'm running into a big problem: I'm trying to simulate the movement of the mouse to a point on the...
3
by: Emjay | last post by:
Newbie needs to know how to set the mouse position.
13
by: James Bond | last post by:
Hello. My 80+ year old father has recently decided to get his first computer. Due to his age (and I suspect lack of playing pong as a child like I did) he lacks the manual dexterity to use a mouse...
5
by: Mike | last post by:
I'm looking for a wireless mouse that which allows me to change the X-Y orientation, so that left is right, right is left, up is down, and down is up. Can anyone point me in the right direction?
7
by: Martijn Mulder | last post by:
When the mouse is over a picture, the user can grow or shrink it by rolling the central mouse wheel. What behavior is typical when the user rolls the wheel away. Will the picture grow or shrink...
5
by: EggHead | last post by:
Hi all, My development environment is VB 6.0, and my OS is winxp. I would like to know how to find the mouse location at a control when the mouse is point at that control. The problem is that the...
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.