event-handling

How to force event handling while inside a recursive function?

I'm writing a screensaver in C# that slowly draws the Sierpinski triangle. I use Thread.Sleep inside the recursive function to slow down the drawing. But I need a way to allow the user to exit by moving the mouse, pressing a key, etc. As my drawing function is called from inside the Paint event handler of the form, mouse and keyboard eve...

how to make a click or double click on a word on a webpage to trigger an event handler?

for a page like http://www.answers.com if the user double clicks on any word in the page, a pop up box will show up and shows the definition for that word. I can think of a way to use DOM scripting to break up all words in the page and then make each of them go under a separate "span" element... but otherwise isn't it true that if all...

When I click a button on the form...my code never reaches it's onclick event.

I have a dropdownlist and a textbox with a button on a form. When a button is clicked it does not go to my onclick even in the code but it goes to my dropdownlist's selectedIndexchanged event. How can I fix this? ...

Modify html output at server side in ASP.NET

A third-party's webcontrol generates the following code to display itself: <div id="uwg"> <input type="checkbox" /> <div>blah-blah-blah</div> <input type="checkbox" /> </div> Is it possible to change it to <div id="uwg"> <input type="checkbox" disabled checked /> <div>blah-blah-blah</div> <input type="checkbox...

vb.net textbox validation against a database?

one of the fields on my form is a textbox that the user types an id. this is the foreign key to another table so I need to bounce the data against that table before letting them submit. I'd rather not use textchanged as every letter they type may incur another query, focus lost would only show an error or validate when they are already i...

ASP.Net Event Loop Order

I've had so many problems with this (usually with page load events being executed before button click events from the previous page) that I decided to look it up and post the event loop ordering: Method Called Controls ------------------------------------------------------ 1. Constructor ...

Adding a list of UserControls with buttons to a PlaceHolder - no event?

I want to make use of "complex" usercontrols with more than one control element within. Its the same control I will reuse in the list and I have a PlaceHolder control for it already. I can add the control with LoadControl(path to .ascx) - no problem. I can thru my custom properties get/set access the embedded Labels too, so I can initi...

Access an event on a DataModule from another Form

In Delphi 2009 I have a Form with a procedure MyProcedure that writes to a label on the Form. The form uses a DataModule with a ClientDataSet. When the AfterScroll event of the ClientDataSet is fired MyProcedure should be executed. To avoid circular references and more important, as I want the DataModule to be reusable, the DataModule s...

Disable redirect on drag image or link

The problem is the following: I am using a tinymce editor (not related with the problem) and an external image manager aplication. We use the drag&drop functionality for users, to just drag the image from the image manager to the tinymce content area. However, there is a problem when the user inadvertantly drags the image outside the c...

How can I programmatically link an UIView or UIImageView with an event like "touch up inside"?

Interface Builder will only allow me to hook up such events for an button. But like in HTML, I just want to haven an blank UIImageView where - as soon as the user taps it - a method is invoked. I hope there is some cool programmatically way of doing that, which I don't know about. UPDATE: In my View Controller that creates the UIImage...

How to subscribe to other class' events in c#?

A simple scenario: a custom class that raises an event. I wish to consume this event inside a form and react to it. How do I do that? Code examples, please! Note that the form and custom class are separate classes. ...

How can I create my own events in my C# application like the default ones available?

I needed to update the system tray icon's text value, of my application, whenever a user hovers over it. I noticed that no such event exists for system tray icons. Is it possible to create a hover event for a system tray icon and if so how can I go about accomplishing it? ...

keydown in flex Flex

I have an small application in flex in which I have defined 2 canvases. On one of them I added controls and the other one is used to draw something and no controls are added: <mx:Canvas x="0" y="80" width="100%" height="520%" id="Canvas1"/> <mx:Canvas x="0" y="0" width="100%" height="80" id="Canvas2"/> I add an keydown event handled t...

In Flash AS3, Is there anyway to detect a DoubleClick action without it detecting the MouseClick?

I have 2 seperate events that are not related to each other and each is attached to the Mouseclick and Doubleclick eventresponses respectively. However, during runtime, I find that even when I doubleclick, the Mouseclick action still gets activated. I've been trying to find a viable solution where the Mouseclick and Doubleclick can co-...

C# Windows Form created by EventHandler disappears immediately

I don't know why this is happening, but when I create a new form inside an EventHandler, it disappears as soon as the method is finished. Here's my code. I've edited it for clarity, but logically, it is exactly the same. static void Main() { myEventHandler = new EventHandler(launchForm); // Code that creates a thread which cal...

How do you test that a Range in Excel has cells in it?

I've found a problem in Excel/VBA in the Worksheet_Change Event. I need to assign Target.Dependents to a Range, but if it has no dependents it brings up an error. I tried testing Target.Dependents.Cells.Count but that didn't work. Any Ideas? Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 OR Target.Depe...

What happens when an event fires and tries to execute an event-handler in an object that no longer exists?

In one class, ClassA, I have a timer object. In this class I register the event handlers for the timer elapsed event. In another class, ClassB, I have a public event-handler for the timer elapsed event. So I register the event-handler from ClassB in ClassA as follows: myTimer.Elapsed += ClassBInstance.TimerElapsed What happens if I we...

ASP.NET control events exception handling

Suppose I have a button in an aspx page that performs a save of the form data to the database. In the associated event handler, before sending the updates, I read something from a webservice, operation that might result in an exception. In case of an error I want to have an adequate message displayed on the page, and all the data in the ...

flash event listener for global events

I have a series of MovieClips, held within several MovieClips, that dispatch a custom move event that I would like the stage to listen for and interact with. Is there a way to add to the stage (or any Object) an event listener for any event of one type, regardless of where it was dispatched from? For instance, could I add to the stage a...

C# pattern to prevent an event handler hooked twice

Duplicate of: How to ensure an event is only subscribed to once and Has an event handler already been added? I have a singleton that provides some service and my classes hook into some events on it, sometimes a class is hooking twice to the event and then gets called twice. I'm looking for a classical way to prevent this from happening....