event-handling

How to attach event handlers to document elements on the fly using Javascript?

Hi Guys, Is there a way to attach an event handler like onclick=alert("Hi"); to an existing document element? (an image in my case) I have already tried and failed with the following: img = document.getElementById("my_image"); img.onclick = "alert('hi')"; img.setAttribute ('onclick',"alert('hi')"); img.onclick = function() {"alert(...

Routing Key events to other control

Is there any standard way to route all Key events from the control A to other control B? I wish that the keyboard focus will still be on A however the event handler of A would trigger the all event handlers of B for the key events. edit: Clarification: calling a specific event handler I wrote for B is not enough. I need to mimic the act...

How to mark C# event handler as "handled"?

Say I've got a button on a form that I want to disable if some condition is met. Is there a way to check for this condition inside the button's "IsEnabled" event handler and modify the enabled state such that setting the enabled state a second time does not trigger another call to the IsEnabled event handler? Let me demonstrate: privat...

Problem with HDN_ENDTRACK when resizing a list column

Hello Stack Overflow. I am having a bit of a problem when handling a HDN_ENDTRACKW message for a custom class which derives from CListCtrl . Essentially, it seem that when this message is sent, the actual value which stores the width of the column is not updated until after my handling code has been executed. The code inside the handl...

C# - ASP.NET Button click event not working

I have an ASP.NET (C#) page with some 3rd party controls, some ajaxy stuff and some normal ASP.NET Button controls. The Button click events do not fire when clicked. Double-clicking the button in design mode in VS 2008 switches to the code-behind but doesn't create the event handler. Creating the event handler manually doesn't help. ...

jquery: accordion and combobox

Greetings, I got trapped by following problem: We got an non-accordion Menu, and within this menu several combo boxes. The problem is, that actually none of the combo boxes are shown properly (no matter if you use the "traditional" combo boxes, or some fancy sexy-combo, /auto complete combo boxes etc.). Here the code: <html xmlns="...

C++ Win32 keyboard events

I am working on my keystroke logger for personal interest and asked a question related to this about yesterday; While loop using a lot of CPU. The issue with the program was that it took too much CPU Usage, and people have suggested to make the inputs key-event based. Since I'm new to the Win32 API, I try to look for references and tut...

Events in Windows

hi How can i capture all user raised events in my application, is there any specific event which is parrent for all of user based(raised) events ? eg : mouse click, key press, etc., these all events are raised by user can i able to capture it under one method??? ...

ASP.NET UserControl not being updated after event

I have a asp.net control that represents a table and a control that represents a row in the table. Each row contains a text field for a date and a button to submit the date entered. <asp:TextBox ID="TextBox" runat="server"/> <asp:ImageButton ID="SubmitButton" onclick="SubmitButton_Click" runat="server" /> The button fires an event ...

Pass a return value back through an EventHandler

Im trying to write to an API and I need to call an eventhandler when I get data from a table. Something like this: public override bool Run(Company.API api) { SomeInfo _someInfo = new SomeInfo(); if (_someInfo.Results == 1) return true; else return false; using (MyTable ...

MouseLeave event in Silverlight 3 PopUp control

I want use PopUp (System.Windows.Controls.Primitives.PopUp) control to show some context menu. After mouse leaves, should automatically close. But eventhandler for MouseLeave is never executed. Why? SAMPLE: void DocumentLibrary_Loaded(object sender, RoutedEventArgs e) { DocumentLibraryDialog documentLibraryDialog = new DocumentLibr...

JavaScript - detecting change in a textarea

I'd like the value of two textareas to always be equal. Listening for a 'change' event is not sufficient because I want these fields to be equal even when one has focus. Listening for a keypress doesn't seem to work either as this event is fired before the field's value is updated with the new letter, so I'm not sure if there's a good wa...

Usercontrol events dont fire in Httphandler

uitest.ascx usercontrol events dont fire, does anyone have a clue about it? business.Pages.Page page1 = new business.Pages.Page(); System.Web.UI.HtmlControls.HtmlForm form = new System.Web.UI.HtmlControls.HtmlForm(); UserControl uc = (UserControl)page1.LoadControl("~/use...

Flash AS3 EventDispatcher - any way of getting a list of registered listeners?

Is there any way of getting a list of registered listeners for an EventDispatcher? I know that EventDispatcher has the hasEventListener method to tell you if any listeners are registered, but is there an easy way of interrogating the EventDispatcher to find out what the listeners are? One way I figured to do this was to subclass Event...

How to remove all event listeners from a display object?

Is there a way to determine which event listeners are registered with a display object? I want to remove all event listeners from a display object so that I can assign new ones based on context changes in the application. ...

ASP.Net User Control - VS Event Wireup

So i've got a custom user control. I have an event (SelectionChanged) and I'm wanting to have who ever uses my control to do the following to hook up the event: drag the control to the page in designer mode, click on the control view the controls event handlers (from the properties window) find the SelectionChanged event double click a...

Should I use an event to notify a class or just use return?

I'm cutting my teeth on events and delegates today and to do so, I have been toying with the idea of experience bars, those progress bars from games. But I have a question about the better way to solve my problem - it could be as simple as bad design. Let me provide you some details. I have modelled my idea with an ExperienceBar class. ...

JavaScript - Detecting when neither of two inputs has focus

I want a certain function to be called when neither of two inputs on the page has focus. If the user merely switches from one input to the other, I do not want the function to be called. Any ideas? ...

XNA - Passing Information Between GameScreens

So, here's what I'm trying to do: I'm making a game for practice using the GameStateManagement example from creators.xna.com. The whole of the system is too much to explain here, so experience with the sample is kind of necessary. The gist of it is that there are multiple game screens that overlay one another. One contains a board, ov...

WinForms - Prevent the Changing of a ComboBox - DropDownList mode

In Winforms what is proper way to keep a user from changing the value of a DropDown? I want to prompt the user to say that there are unsaved changes. If the user decides to not throw away these changes I want to cancel the combobox changing. Any ideas on how to do this? I though I had seen a e.Cancel option before. But maybe not on Syst...