events

jQuery event on responsed data from server

I have some content from server using $.ajax() function. I try to replace some element with this data and then manipulate it. Here is code: $.ajax({ type: "GET", url: "smpl.php", success: function(servmsg){ $('#panelInfo').replaceWith('<p>' + servmsg + '</p>'); } }); response from server is: <select id="years"> <option>2008...

Porting Windows library using Qt to MacOSX, event loops

Hi, I'm inserting a hook in the MFC message loop so that the Qt events are treated, without running ->exec() on qApp (because it's blocking): LRESULT CALLBACK myHookFn(int ncode, WPARAM wparam, LPARAM lparam) { if (qApp) qApp->sendPostedEvents(); return CallNextHookEx(0, ncode, wparam, lparam); } and int argc = 0; new QAppli...

Find callback functions added with jQuery on DOM elements

I am currently testing this in Mozilla FireFox 3.0.5 using FireBug 1.3.0 with jQuery 1.2.6. First try document.getElementById("x").onfocus = function () { var helloWorld = "Hello World"; }; FireBug console: document.getElementById("helloworld").onfocus.toString() = function body as a string $("#helloworld").get(0).onfocus.toStr...

Python: Callbacks, Delegates, ... ? What is common?

Hi! Just want to know what's the common way to react on events in python. There are several ways in other languages like callback functions, delegates, listener-structures and so on. Is there a common way? Which default language concepts or additional modules are there and which can you recommend? ...

Assign Errors to projects in Logger for MSBuild2008 with /m:x (x > 1)

We build using MSBuild2005 with a self-written Logger class that keeps track of which projects are currently building and assigns the incoming errors/warnings to the projects. This was a kind of tricky because MSBuild also calls ProjectStarted/FinishedEventArgs when it "somehow" accesses referenced projects. But I got it working. Now we...

WPF EventRouting to Children

Is there any way to broadcast a RoutedEvent to all of my children in WPF? For example lets say I have a Window that has 4 children. 2 of them know about the RoutedEvent 'DisplayYourself' and are listening for it. How can I raise this event from the window and have it sent to all children? I looked at RoutingStrategy and Bubble is the ...

Does casing matter when spelling DOM event names?

When specifying a DOM event name in Javascript, does casing matter? For example, which of the following will work reliably: onMouseOver onmouseover Both are ok. Casing does not matter. It's more complicated than that.... ...

How to find event listeners on a DOM node?

I have a page where some event listeners are attached to input boxes and select boxes. Is there a way to find out which event listeners are observing a particular DOM node and for what event? Events are attached using 1) prototype's Event.observe 2) DOM's addEventListener 3) as element attribute element.onclick ...

In Flex, how do I know when the properties of a dynamic object change?

I have a dynamic class that serves as a storage container for configuration settings. The settings are variables of that class and it has methods to read from and write to a configuration file, database etc. Now I want to trigger writing to the persistant storage whenever a class variable is changed. As the variables are added dynamicall...

How do I access Mouse movement events in WPF regardless of where the mouse is?

I have tried to use the MouseMove event to track the position of the mouse. protected override void OnMouseMove(MouseEventArgs e) This works when the mouse is over the given UIElement (in this case, my application's window,) however I would like to access this data regardless of where the mouse is, and preferably even regardless of wh...

Creating Win32 events from c#

I'd like create a kernel(aka named events) from C#. Do I have to interop services and wrap the native CreateEvent function or is there already a .NET class that does the job? The function that I need to run should be something like this: hEvent = CreateEvent ( NULL , false , false , "MyCSHARPEvent" ); This should notify all procs t...

How do I unsubscribe all handlers from an event for a particular class in C#?

Basic premise: I have a Room which publishes an event when an Avatar "enters" to all Avatars within the Room. When an Avatar leaves the Room I want it to remove all subscriptions for that room. How can I best unsubscribe the Avatar from all events in the room before I add the Avatar to a new Room and subscribe to the new Room's events...

Unregistered event handlers cause memory leak

I'm maintaining a web application that has a memory leak. Based on my investigation using Red Gate ANTS memory profiler I'm pretty sure that the memory leak is caused by event handlers in the business layer. There's a collection that registers an event handler on each item that's added so that the collection can re-sort when the item's...

Java Events: Is this a good way to go about it?

I'm reimplementing a .Net API in Java and the API specifies a whole bunch of events, ehich java doesn't implicitly support. I'm going to use an observer pattern but due to the number of event I really don't want to clutter the interface. I was wondering if it was a good idea to declare an "Event" class which has a subscribe method whic...

Is there an idiomatic way to listen for changes to the DOM using the Prototype library?

I'm trying to add a listener to DOM change events. I was hoping something as simple as 'dom:loaded' was baked into Prototype. I'm not sure of the 'Prototype-way' to handle this. EDIT: I cannot control every case in which the DOM may be altered, so I can't get away with firing a custom event on every DOM change. ...

What is the best way to associate an Event with a Class in ActionScript / Flex 3?

ActionScript 3 / Flex 3 - Adding custom events to a class Say I have the following Event: import flash.events.Event; public class SomeEvent extends Event { public static const EVENT_ACTION:String = "eventAction"; public function SomeEvent(type:String) { super(type); } override public function clone():Event { ...

Using IDisposable to unsubscribe events

I have a class that handles events from a WinForms control. Based on what the user is doing, I am deferencing one instance of the class and creating a new one to handle the same event. I need to unsubscribe the old instance from the event first - easy enough. I'd like to do this in a non-proprietary manner if possible, and it seems like ...

Flex: Determine if a component is showing

What is the best way to determine if a component in Flex/Flash is showing on the user's screen? I'm looking for an analog to Java's Component.isShowing() method. The show and hide events fire for visibility, and this seems to work for the first descendant of a ViewStack component, but not further down the display tree. ...

Textarea lags after registering `keydown` events using Javascript

How does one go about attaching a bunch of code to an onkeydown event, but keep entering text into a textarea fast and crisp? Anything more than a couple of IF statements seems to slow it down quite considerably. EDIT: I should add (can't believe I forgot!) that this doesn't affect desktop browsers. It's mainly an issue with iPhone Safa...

Jquery Event Bubbling CheckBox

I have a form with checkboxes and then text to the right of the checkbox. There are jquery events attached to the click events of the the checkbox. What I want is to allow the user to click on the label or the checkbox and have the checkbox check/uncheck and the event to fire. Below is a simplified version of what I'm trying to do (DO...