events

Calling C# events from outside the owning class?

Is it possible under any set of circumstances to be able to accomplish this? My current circumstances are this: public class CustomForm : Form { public class CustomGUIElement { ... public event MouseEventHandler Click; // etc, and so forth. ... } private List<CustomGUIElement> _elements; .....

How do I handle the window close event (user clicking the 'X' button) in a Python Tkinter program?

How do I handle the window close event (user clicking the 'X' button) in a Python Tkinter program? ...

Flash: Coming back from another tab in browser, can flash listen to return to tab event of some sort ?

I got this flash application where you can click a link while watching a video. It will open a new tab and pause the video. Now when you come back to the flash application it would be nice if the video would start playing again. Is there a way, an event or so to do this ? ...

How can I bind an event handler to an instance in JQuery

I am trying to bind an event to a "method" of a particular instance of a Javascript "class" using JQuery. The requirement is that I in the event handler should be able to use the "this" keyword to refer to the instance I originally bound the event to. In more detail, say I have a "class" as follows: function Car(owner) { this.owner =...

What is the difference between Events with Delegate Handlers and those without?

What is the difference between this: this.btnOk.Click += new System.EventHandler(this.btnOK_Click); and this? this.btnOk.Click += this.btnOK_Click; They both work. The former is what Visual Studio defaults to when you use the snippets. But it seems like it only ads extra verbiage, or am I missing something? ...

When onblur occurs, how can I find out which element focus went *to*?

Suppose I attach an onblur function to an html input box like this: <input id="myInput" onblur="function() { ... }"></input> Is there a way to get the ID of the element which caused the onblur event to fire (the element which was clicked) inside the function? How? For example, suppose I have a span like this: <span id="mySpan">Hello...

Timed events with php/MySQL

I need a way to modify a value in a table after a certain amount of time has passed. My current method is as follow: insert end time for wait period in table when a user loads a page requesting the value to be changed, check to see if current >= end time if it is, change the value and remove the end time field, if it isn't, do nothing...

Breaking event cycles in GUIs

When writing GUIs, I've frequently come over the following problem: Assume you have a model and a controller. The controller has a widget W that is used to show a property X of the model. Because the model might be changed from outside the controller (there might be other controllers using the same model, undo operations etc), the contr...

Adding a web reference to a DLL which is GACed

I come across this problem when i am writing an event handler in SharePoint. My event handler has a web reference. When i create this web reference, the URL of the web service will be added in the .config file of the assembly. If i have to change the web reference URL i just have to change the link in the config file. Problem comes whe...

MSWinsock.Winsock event handling in VisualBasic

I'm trying to handle Winsock_Connect event (Actually I need it in Excel macro) using the following code: Dim Winsock1 As Winsock 'Object type definition Sub Init() Set Winsock1 = CreateObject("MSWinsock.Winsock") 'Object initialization Winsock1.RemoteHost = "MyHost" Winsock1.RemotePort = "22" Winsock1.Connect Do Wh...

Passing JS function to applet for as event listener

Is it possible to pass a function/callback from javascript to a java applet? For example i have an applet with a button that when pressed it will call the passed js callback function onCommand() {alert('Button pressed from applet');} applet.onCommand(onCommand); ...

ASP .Net server control events order

Which are the events of an ASP .Net server control and how does their order relate to the containing page's events? The concrete problem is that I am looking for an event inside the server control that fires before the *Page_Load* event of the containing page. ...

.NET EventHandlers - Generic or no?

Every time I start in deep in a C# project, I end up with lots of events that really just need to pass a single item. I stick with the EventHandler/EventArgs practice, but what I like to do is have something like: public delegate void EventHandler<T>(object src, EventArgs<T> args); public class EventArgs<T>: EventArgs { private T i...

Flex: Why can't I handle certain events?

In certain cases, I can't seem to get components to receive events. [edit] To clarify, the example code is just for demonstration sake, what I was really asking was if there was a central location that a listener could be added, to which one can reliably dispatch events to and from arbitrary objects. I ended up using parentApplicatio...

How can I use an event to cause a method to run?

So in my documentation it says: "C# public event TreeViewPlusNodeCheckedEventHandler NodeChecked() You can use this event to run cause a method to run whenever the check-box for a node is checked on the tree." So how do I add a method to my code behind file that will run when a node is checked? The method I want to run is: protected...

Flash: Listen to all events of a type with one eventlistener

It's not a matter of life or death but I wonder if this could be possible: I got a couple of events from one type of custom event (FormEvent) now I got a FormListener that listens to all those events and handles them according to the event type. Instead of adding one eventListener at the time I wish to add all events at once. so now it...

Flex - Avoid click event on container when enclosed component is clicked

I have a Flex application where I'm using a Canvas to contain several other components. On that Canvas there is a Button which is used to invoke a particular flow through the system. Clicking anywhere else on the Canvas should cause cause a details pane to appear showing more information about the record represented by this control. T...

Get Bound Event Handler in Tkinter

After a bind a method to an event of a Tkinter element is there a way to get the method back? >>> root = Tkinter.Tk() >>> frame = Tkinter.Frame(root, width=100, height=100) >>> frame.bind('<Button-1>', lambda e: pprint('Click')) # function needed >>> frame.pack() >>> bound_event_method = frame.??? ...

If I register for an event in c# while it's dispatching, am I guaranteed to not get called again during that dispatch?

In C#, I find myself occasionally wanting to register a method for an event in the middle of a dispatch of that same event. For example, if I have a class that transitions states based on successive dispatches of the same event, I might want the first state's handler to unregister itself and register the second handler. However, I don'...

Proper place to call an event?

I have a Windows Form project that I've just started. On the form I have a listbox that I'm loading with Products. When someone double clicks a Product, I want it to raise a ProductChanged event. Other things in my project will subscribe to this event and update things like other parts of the GUI when the Product changes. My question i...