events

Javascript Events: Getting notified of changes in an <input> control value

I have the following problem: I have an HTML textbox (<input type="text">) whose contents are modified by a script I cannot touch (it is my page, but i'm using external components). I want to be notified in my script every time the value of that textbox changes, so I can react to it. I've tried this: txtStartDate.observe('change', fu...

jQuery - Triggering Events from Clicking on a Link Issue

I'd like to trigger an event when a link is clicked both by clicking on it normally or by opening it in a new tab (e.g., middle click, ctrl + click, etc) I've tried the following so far: $('a').click(myfunc) Doesn't capture middle clicks. $('a').mousedown(myfunc) works, but it seems to be preventing the link from being followed even ...

How can I give keyboard focus to a DIV and attach keyboard event handlers to it?

I am building an application where I want to be able to click a rectangle represented by a DIV, and then use the keyboard to move that DIV Rather than using an event listener for keyboard events at the document level, can I listen for keyboard events at the DIV level, perhaps by giving it keyboard focus? Here's a simplified sample to i...

Intercept Windows Vista shutdown event in C#

I want to be able to intercept the shutdown event in C# for Windows Vista. Due to the advanced security features with Vista, any applications that are running after the shutdown command is called are halted and displayed in a list, prompting the user to do something with them. Does anybody know how to overcome this and what events I ne...

Using events rather than exceptions to implement error handling

I'm working on some code that uses a pattern in its business and data tiers that uses events to signal errors e.g. resource = AllocateLotsOfMemory(); if (SomeCondition()) { OnOddError(new OddErrorEventArgs(resource.StatusProperty)); resource.FreeLotsOfMemory(); return; } This looked superficially rather odd, espec...

AJAX.NET Subscribe to Reorderlist ItemCommand or DeleteCommand?

I would like to subscribe to the ItemCommand event of a Reorderlist I have on my page. The front end looks like this... <cc1:ReorderList id="ReorderList1" runat="server" CssClass="Sortables" Width="400" OnItemReorder="ReorderList1_ItemReorder" OnItemCommand="ReorderList1_ItemCommand"> ... <asp:ImageButton ID="btnDelete" runat="server"...

How to handle an ActiveX event in Javascript

This is somewhat of a follow-up to an answer here. I have a custom ActiveX control that is raising an event ("ReceiveMessage" with a "msg" parameter) that needs to be handled by Javascript in the web browser. Historically we've been able to use the following IE-only syntax to accomplish this on different projects: function MyControl::R...

How to clear event subscriptions in c#

Take the following c# class: c1 { event EventHandler someEvent; } If there are a lot of subscriptions to c1's 'someEvent' event and I want to clear them all, what is the best way to achieve this? Also consider that subscriptions to this event could be/are lambdas/anonymous delegates. Currently my solution is to add a ResetSubscriptio...

Setting WPF dependency property without triggering events

Hi, I need to set a dependency property on a control (Slider.Value) in my code without it triggering a ValueChanged event (since I set the value, not the user). What is the best way to handle this situation in WPF? For clarification, what I am trying to do is hook up WPF sliders to a WinForms User Control. Currently in my app I have a ...

Control.Enter event doesn't fire when switching tasks. Is there an alternative that does?

Rep steps: create example .NET form application put a TextBox on the form wire a function up to the TextBox's Enter event When you run this application, the Control.Enter event fires when focus first goes to the TextBox. However, if you click away into another application and then click back into the test application, the event will...

Sending a keyboard event from java to any application (on-screen-keyboard)

I am working on developing an on-screen keyboard with java. This keyboard has a JComponent for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currently on focus. The keyboard itself is within a JFrame with no decorations and set to always-on-top. I found tha...

Date change notification in a Tkinter app (win32)

Does anyone know if it is possible (and if yes, how) to bind an event (Python + Tkinter on MS Windows) to a system date change? I know I can have .after events checking once in a while; I'm asking if I can somehow have an event fired whenever the system date/time changes, either automatically (e.g. for daylight saving time) or manually....

Is it a good design to put event handling code into an own method?

Image a Button on your windows form that does something when being clicked. The click events thats raised is typically bound to a method such as protected void Button1_Click(object sender, EventArgs e) { } What I see sometimes in other peoples' code is that the implementation of the buttons' behaviour is not put into the Bu...

Field default value from query in MS Access

I have a field on a table in MS Access, tblMyTable.SomeID, and I want to set the default value as a user preference in tblUserPref.DefaultSomeID. It doesn't appear that I can set the default value to use a query in the table definition of tblMyTable. I have a form where records are entered into tblMyTable. I've tried to set the defaul...

What language/methods to use to listen to removeable drives in Windows?

What language or method would I use to listen to the event when a removeable drive is plugged into the PC? ...

Events in C#

Just how much slower are events? I have written a streaming XML parser (that can handle open-ended and incomplete documents) and by tearing out the events and using an interface instead I got a significant speed boost. Does any one else have any war stories? (Let's not open the GC can of worms here, we all know it's broken :)) ...

How do I grab events from sub-controls on a user-control in a WinForms App?

Is there any way for the main form to be able to intercept events firing on a subcontrol on a user control? I've got a custom user-control embedded in the main Form of my application. The control contains various subcontrols that manipulate data, which itself is displayed by other controls on the main form. What I'd like is if the mai...

Javascript callback when IFRAME is finished loading?

I need to execute a callback when an IFRAME has finished loading. I have no control over the content in the IFRAME, so I can't fire the callback from there. This IFRAME is programmaticly created, and I need to pass its data as a variable in the callback, as well as destroy the iframe. Any ideas? EDIT: Here is what I have now: functi...

How do I create a Routed Event in Silverlight 2?

Anyone know how to create a routed event in Silverlight 2? In WPF, the code would be like below. However, there’s no EventManager in Silverlight. public static readonly RoutedEvent ShowVideoEvent = EventManager.RegisterRoutedEvent("ShowVideo", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(NavBar)); public...

C# .Net exe doesn't close when PC is restarted, keeping the machine from restarting

We have a SmartClient built in C# that stubornly remains open when the PC its running on is being restarted. This halts the restart process unless the user first closes the SmartClient or there is some other manual intervention. This is causing problems when the infrastructure team remotely installs new software that requires a machine...