473,763 Members | 9,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.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 1827
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.GetNod eAt
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.GetNo deAt
4. Then, show the context menu at point, provided by MouseEventArgs

.

Jul 21 '05 #3
Max
"serge calderara" <an*******@disc ussions.microso ft.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.GetNo deAt
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
3604
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 language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
8
6088
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 uses message queues to pass pointers to Events between threads. In my app there are simple events that can be defined using an enum (for example an event called NETWORK_TIMEOUT) and more complex events that contain data (for example an event called...
7
2448
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 fonction Main si je remplace Suite('+param+') par Suite('+40+') then all is ok. For info, the parameter "param" will be a string Thanks for your help
4
1754
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 protected method of the base class". Can someone please explain this with a sample code? Thanks a lot.
3
2081
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 following scenario Server (COM event source) is written in VC++ 6.0 using ATL (event interfaces can be either dispinterface / IDispatch based) Client (COM event receiver) is written in VC++ 2003 using attributed programming and unified event handling
7
3456
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 pass the items in the datagrid(e.g. PLU, description, etc.) to an other (detail)page, but i don't know the correct syntax of how to pass the textbox value to the detailpage. I have the following code:
2
2137
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 database. This works fine. However, I attempt to notify the user when data accesses occur. The way I attempt to accomplish this is by changing the background color of a label on the form the user is looking at. I use red for when the database is...
3
286
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 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
0
9387
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7368
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.