Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
(C#) Raise an Event
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01016081
Message ID:
01016521
Views:
14
>>>Uhm, this maybe to obvious but, can't you just call the handler method directly?
>>>
>this.OnPopupHandler(this.mnuMyButton,EventArgs.Empty);
>
>>>
>Apologies, but I'm not too bright <g>. I don't get it. "this" would be my form (System.Windows.Forms.Form), so there's no .OnPopupHandler there. I haven't created the .Popup event, it's a member of MenuItem. To be honest, events in C# are a little murky for me, but whenever I've seen .OnxxxHandler, it's the naming convention when one creates one's own events.

Actually I was thinking of somethign else - handling the event which is not what you're after. you're after showing the menu which is something that can't be done with the stock behavior of the control.

Events are fired from the system and you can't simulate this particular operation by calling the event. You can raise the event but even if you did you'd only cause the event handler hooked up to it to fire, rather than make the 'event trigger' (the popup operation) happen.

In order to do this you'll likely need Windows API calls with SendMessage().

Offhand I don't know what WM_ message you'd need but you can probably find some help on Google. Or look into the Windwos API message section of MSDN.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform