473,387 Members | 1,572 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,387 software developers and data experts.

.Add parameter in event handling ???

Dear all,

I have a class named for Instance "MyClass" which populate
trough an interface a context menu object to the main
application.
The click event on any of the context menu itemm will be
proceed in the myClass event handler. Actally default
event handle has two parameters: Sender and e

Actually the context menu is shown in my main application
when I selecte a tree node object and right click the
mouse button. When the click event is proceed I need to
inform my eventhandler in myClass the selected node when
menu item was clicked.

What is the way to pass to my eventhandler the selected
tree node object?

thnaks for your answer
regards
Serge
Jul 21 '05 #1
3 1796
Max
> Dear all,

I have a class named for Instance "MyClass" which populate
trough an interface a context menu object to the main
application.
The click event on any of the context menu itemm will be
proceed in the myClass event handler. Actally default
event handle has two parameters: Sender and e

Actually the context menu is shown in my main application
when I selecte a tree node object and right click the
mouse button. When the click event is proceed I need to
inform my eventhandler in myClass the selected node when
menu item was clicked.

What is the way to pass to my eventhandler the selected
tree node object?

Maybe it is not the best solutuion but:
1. Set ContextMenu property of TreeView to null
2. Handle MouseUp event of TreeView
3. When right button pressed determine selected item by calling
TreeView.GetNodeAt
4. Then, show the context menu at point, provided by MouseEventArgs
Jul 21 '05 #2
You did not catch what I was meaning.
I have no problem to pop up the context menu in the tree
view control.

The problem I get is that when I click on item in that
menu, the eventhandler belong to myClass. Whcih means that
the clickevent process will be handle by myClass, but in
order to handle it properly in my case, myClass
eventhandler need to know from where the click as been
generated and in my case I need to pass as a parameter to
my eventhandler a Treenode object.

how can I do that ?
-----Original Message-----
Dear all,

I have a class named for Instance "MyClass" which populate trough an interface a context menu object to the main
application.
The click event on any of the context menu itemm will be
proceed in the myClass event handler. Actally default
event handle has two parameters: Sender and e

Actually the context menu is shown in my main application when I selecte a tree node object and right click the
mouse button. When the click event is proceed I need to
inform my eventhandler in myClass the selected node when
menu item was clicked.

What is the way to pass to my eventhandler the selected
tree node object?
Maybe it is not the best solutuion but:
1. Set ContextMenu property of TreeView to null
2. Handle MouseUp event of TreeView
3. When right button pressed determine selected item by

callingTreeView.GetNodeAt
4. Then, show the context menu at point, provided by MouseEventArgs

.

Jul 21 '05 #3
Max
"serge calderara" <an*******@discussions.microsoft.com> wrote in message
news:0d****************************@phx.gbl...
You did not catch what I was meaning.
I have no problem to pop up the context menu in the tree
view control.

The problem I get is that when I click on item in that
menu, the eventhandler belong to myClass. Whcih means that
the clickevent process will be handle by myClass, but in
order to handle it properly in my case, myClass
eventhandler need to know from where the click as been
generated and in my case I need to pass as a parameter to
my eventhandler a Treenode object.

how can I do that ? You can't pass the TreeNode object in MenuItem click event arguments.
There are no simple way to do determine tree node where user have clicked in
context menu click event. See my previous post
-----Original Message-----
Dear all,

I have a class named for Instance "MyClass" which populate trough an interface a context menu object to the main
application.
The click event on any of the context menu itemm will be
proceed in the myClass event handler. Actally default
event handle has two parameters: Sender and e

Actually the context menu is shown in my main application when I selecte a tree node object and right click the
mouse button. When the click event is proceed I need to
inform my eventhandler in myClass the selected node when
menu item was clicked.

What is the way to pass to my eventhandler the selected
tree node object?

Maybe it is not the best solutuion but:
1. Set ContextMenu property of TreeView to null
2. Handle MouseUp event of TreeView
3. When right button pressed determine selected item by

calling
TreeView.GetNodeAt
4. Then, show the context menu at point, provided by

MouseEventArgs

Jul 21 '05 #4

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

Similar topics

10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
7
by: Chris | last post by:
<< Translation in english of my main post >> Hi, I do not success to pass by parameter the contents of "param". in the function "Main" if I replace Suite('+param+') by Suite('+40+') dans la...
4
by: hillcountry74 | last post by:
Hi, I'm a newbie and trying to understand event handling in c#. I have understood handling events using delelgate objects. But not this method- "Event handling by overriding the virtual...
3
by: Ashok Kumar K | last post by:
Hi all, Where can I get some insight on using the __hook, __unhook, event_source and event_receiver for specifically COM events. The documentation given in MSDN is very minimal. I have the...
7
by: Cemal Karademir | last post by:
Hello, Please forgive my simple question, but i don't know the correct synatx. From the masterpage i want to put a text in an textbox and then select an item in the datagrid. I do know how to...
2
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the...
3
by: serge calderara | last post by:
Dear all, I have a class named for Instance "MyClass" which populate trough an interface a context menu object to the main application. The click event on any of the context menu itemm will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.