events

control event - question about thread

Hi Language: C# (WinForms) There is one think I don't fully understand: Suppose I have normal button.Click event. I know for sure from my own experience that if I try to access UI elements from inside of this event I could potentially got unwanted behavior - or even exception (when debugging). The usual exception in such a scenario is...

C# WebBrowser control not firing the DocumentCompleted event

I have a program that is using the C# WebBrowser control and it needs to detect which page is loaded to determine what to do next. The program works fine on most of the employee's computers at the office, but it does not work on some. I have determined the problem is that the documentCompleted event is not firing on those computers it ...

Is keyword 'event' optional in C#?

What is the difference between eventOne (with keyword 'event') and eventTwo (w/o keyword)? class Program { public event EventHandler eventOne; public EventHandler eventTwo; public void RaiseOne() { if (eventOne != null) eventOne(this, EventArgs.Empty); } public void RaiseTwo() { ...

Unregister events with new instance of the delegate

EventHandler a = new EventHandler(control_RegionChanged); EventHandler b = new EventHandler(control_RegionChanged); if (a == b) { Console.WriteLine("Same!"); } else { Console.WriteLine(a.GetHashCode() + " " + b.GetHashCode()); } This wirte "Same!" to the console. control.RegionChanged += new EventHandler(control_Regio...

jQuery hide element when clicked anywhere on the page

I would like to know if this is the correct way of hiding visible elements when clicked anywhere on the page. $(document).click(function (event) { $('#myDIV:visible').hide(); }); The element (div, span etc) cannot disappear when click event occurs withing the boundaries of the element. ...

How virtual events work in C# ?

Below is the program I used for the test. It prints (as expected): Raise A Event from A Raise B Event from B Now, if we change first two lines of the Main to be: A a = new B(); B b = new B(); the Program will print: Raise A Raise B Event from B which is also expected, as overriding event hides the private backing...

Does VB.NET support virtual events?

In continuation of this question. Does VB.NET supports virtual events? ...

YUI: adding event at the top of some event queue after page loading?

How can I put a new event at the top of all attached events linked to an object just after the page load? Pratically I have an accordion using some YUI funcs to activate its behavior, now without modifying the YUI main function I need some new functions used to call AJAX routines. Currently I am trying with Event.getListeners, but I don...

Catching ON_CBN_SELCHANGE and other dropdown events when extending CFileDialog

I am trying to create a custom file save dialog for XP using C++/VS2008. My dialog will have three dropdowns and an edit box. I need the contents of the dropdowns to dynamically update when selections are made on other dropdowns. Hence, my need to catch the CBN_ events. I've created a class that extends CFileDialog and a class that exte...

Handling repeated events in a log

I have a logging system where some events are repeated infinitely. for example: 12:03 - Restart attempted 12:03 - Restart failed 12:02 - Restart attempted 12:02 - Restart failed 12:01 - Restart attempted 12:01 - Restart failed This might go on for days. I imagine there are standard ways that systems deal with spammy events like this. ...

What's the best way to propagate information from my wx.Process back to my main thread?

I'm trying to subclass wx.Process such that I have a customized process launcher that fires events back to the main thread with data collected from the stdout stream. Is this a good way of doing things? class BuildProcess(wx.Process): def __init__(self, cmd, notify=None): wx.Process.__init__(self, notify) print "Const...

Events - naming convention and style

Hi I'm learning about Events / Delegates in C#. Could I ask your opinion on the naming/coding style I've chosen (taken from the Head First C# book)? Am teaching a friend about this tomorrow, and am trying to come up with the most elegant way of explaining the concepts. (thought the best way to understand a subject is to try and teach ...

WPF FileDrop Event: just allow a specific file extension

Hi there, I have a WPF Control and I want to drop a specific file from my desktop to this control. This is not a heavy part but I would like to check the file extension to allow or disallow the dropping. What is the best way to solve this problem? Thanks! ...

Good way of firing an event at a particular time of day?

I have an app that needs to fire off a couple of events at certain times during the day - the times are all defined by the users. I can think of a couple of ways of doing it but none of them sit too well. The timing doesn't have to be of a particularly high resolution - a minute or so each way is fine. My ideas : When the app starts u...

ActionScript MouseEvent.clone() appears broken?

I have run into a problem attempting to redispatch mouse events in ActionScript 3, which I am admittedly a bit incredulous about. I have narrowed it down to the MouseEvent.clone() method appearing, well, completely broken. The following event handler: private function handleMouseMove( evt : MouseEvent ) : void { trace("mousemov...

Event Tracking

I want to understand event cycles. I have a form with a grid and textboxes. It has a grid, bound to DataTable, and textboxes bound to same table too. I'm trying to debug something and need to know how to identify ALL events fired in the form to see what may solve an issue for me. Anyhow, unless I explicitly subclass every class on my...

Differentiating between events raised by user interaction and my own code

The SelectedIndexChanged event gets fired in my application from a combo box when: the user chooses a different item in the combo box, or when: my own code updates the combo box's SelectedItem to reflect that the combo box is now displaying properties for a different object. I am interested in the SelectedIndexChanged event for case ...

Store and invoke an event (VB.NET .NET 2.0)

Hi, I think know how to do this in C# but I'm having syntax trouble in VB.NET because I need to take advantage of the 'handles' event stuff. I have different events that I somehow (probably delegate) need stored in a property of an attribute (I just add an attribute to a property linking to the corresponding event). E.g. <BindEvent(E...

Using remote events in wcf

I want to deliver events from a server application to multiple clients. Since I'm using wcf to expose a service interface to the clients I gave a look in the wcf async callback mechanism, but it seems not to support dispatching one message to multiple clients. Is MSMQ a better way to implement delivery of events to multiple clients. Th...

ListItem Mouse Enter Message Box

Hi, I am using event triggers in my XAML, I have the following style set on a ListItem. What I want is to display the contents of the ListItem in a message box when the mouse enters a list item. <Style.Triggers> <EventTrigger RoutedEvent="Mouse.MouseEnter"> </EventTrigger> </Style.Triggers> I ...