We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Pushing Mouse Events higher up

MsShadow
MsShadow asked
on
Medium Priority
1,417 Views
Last Modified: 2008-01-09
Hi,

I have built a custom usercontrol that displays treeview differently. The first level of the treeview is displayed as a button and the lower levels are displayed as seperate treeviews.

Example: Tree A B C
sublevel A : 1 2 3
sublevel B : 1
sublevel 1 : 1a 1b

so if I click on the button with label A I get to see a tree:
A
 1-
   |-1a
   |-1b
B
C

if I click on b =>

A
B
 1 -
C

All of that works perfectly. All the labels and treeviews are generated during the code executing depending on the data that has been given to the control. I've created my event

        mainLabel.Tv.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(Tv_NodeMouseDoubleClick);

        void Tv_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            clickedNodePath = e.Node.FullPath;
            this.RaiseMouseEvent(this, e);
        }

so that when a node is doubleclicked an event is raised so I can get the full path. The only problem is that
RaiseMouseEvent cannot be used. And the whole idea is that my control which contains my extendedlabels fires an event that can be captured by the form that contains the control.

But I don't manage to raise another event. I prefer not to write my own eventhandler since I already have anotherone in my framework that capturs data read events etcetera.
Comment
Watch Question

"I prefer not to write my own eventhandler"  well then, you are out of luck - the only way to accomplish what you are describing is to have the original event handler, raise a new event, which can the  be handled by the form which is hosting your User Control.  Cascading the events back uup the hosting hierarchy is a fairly common scenario, and there is no other way to accomplish it, other than passing the events up the hosting chain.

Form1 hosts control1 which in turn hosts control1a - control1a raises an event which is handled by control1, which in turn raises a new event, which is then handled by Form1.

AW

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Appearantly you cannot just give an assist accept so i am giving you a full accept. Wrote my own handler.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.