events

Why do WebControl events have the prefix of "On"?

I'm trying to fully understand the WebForm event model (not the page lifecycle, but how the events are wired up when specified declaratively in the .aspx or .ascx files. Take the Button control for example. It has a Click event that you can wire to in the code-behind, but it has an "OnClick" event in the .aspx/.ascx file. I used the .N...

C# WinForms: Waiting for a button press inside an infinite loop

I'm making a simple Guess-The-Number game with a GUI. I need to wait on a loop waiting for the user to input a number in a text box and press "OK". How do I wait for an event inside a loop? Note: I don't want message boxes. This is done in the main window, hence the need to wait for input. EDIT: I should have explained myself better. I...

Measure number of events fired?

I am doing some tuning in a very large application. Is there a way to measure number of events fired in an application? For example using something in System.Diagnostics? Adding code inside events is NOT an acceptable solution due to the size of the application. There are profiling tools, but the fast and simple approach for me would b...

How to explain events to beginners?

Using .NET how do you explain events to a beginner? Most of the introduction books I've looked at talk about a WinForms app, double click the button in designer and viola you have an event. I don't like it since it doesn't explain anything about what's happening behind the scenes or the more complicated things like chaining events. I...

COM event with binary data in arguments

I am trying to develop a COM object using C++ and ATL to be used by both C++ and C# Windows Mobile clients. The COM object wraps up all of the logic to connect to our server and send/receive data using our proprietary protocol. I am having some difficulty coming up with an OnReceive event that works correctly with C# and C++. I have d...

problems with javascript key events

I want to respond to the user hitting the enter key, which I can do, however I dont want to respond to the event when the user hits the enter key and the focus is on the address bar. I can not figure out how to prevent my key event handler from executing when the focus is in the address bar. Note: The page refreshes, but my handler is c...

Mac Event Loop QT Plugin in a NON QT Application

I am trying to write a Trolltech QT library that will be used from a NON-QT CFM Application written in MacApp. I am having trouble that when I have created QApplication it is taking over my event loop in my non-Qt MacApp mac application. I have override QApplication::macEventFilter to call CallNextEventHandler but this calls my Carbon Ev...

How to detect when a Form is being dragged?

I have a Form object with a title bar displayed. I need a pure managed way(P/Invoke-free, both Mono and .NET compatible, preferrably a .NET 2.0 API) to detect when the FORM itself starts being dragged, changes location and when it is dropped(not any content). I did this in the past in Mono but I don't remember how anymore and I don't k...

Does MSDN use wrong terminology when referring to events and their event handlers?!

Hello, I’ve noticed that on several occasions that MSDN uses “wrong” terminology when referring to events and their event handlers. For example: The ProfileAutoSaving event is raised at the end of page execution if the ProfileManager.AutomaticSaveEnabled property is true. You can access the ProfileAutoSaving event of the ProfileMo...

Pass mouse events through absolutely-positioned element

I'm attempting to capture mouse events on an element with another absolutely-positioned element on top of it. Right now, events on the absolutely-positioned element hit it and bubble up to its parent, but I want it to be "transparent" to these mouse events and forward them on to whatever is behind it. How should I implement this? Click ...

How to do multi user event driven screen updates?

I work on a Delphi program that uses a firebird database to store it’s data. It uses a home grown o.r.m. system. When two users look at the same data, for example in a data grid, and one changes something the other screen gets updated immediately. The way this works is that the objects in the one program store them self’s in the databas...

Nested Generic Events

I want to have a generic event that I can fire that will take a custom eventArgs> e Here is my code so far public event resultsEventHandler<T> returnResults; public delegate void resultsEventHandler<T>(object sender, resultEventArgs<ObservableEntityCollection<T>> e); protected virtual void OnreturnResults(resultEventArgs<ObservableE...

Determine if an event has been attached to yet

I have two objects - one that contains some code with will fire an event, and one that contains the handler for that event. I can't "AddHandler" in the Load of the first object, because an instance of the second object doesn't exist yet. When I raise my event, I want to check to see if a copy of object2 has been instantiated (easy to do)...

WPF TreeView - Force SelectedEvent on Item that is already selected

Hello All, Summarized Question: In the WPF TreeView, how can I force the selected event on an item that is currently the selected item? Detailed Info: I am trying to add functionality to my WPF TreeView by adding multiselect using shift(for a range) and control(for toggling selection of an item). I've implemented my own SelectedItems c...

Event-based XPCOM with java

Hello, I'm writing a toolbar for Firefox using Javascript connected to a Java XPCOM component. I want it to send a receive URLs from an external application that the java end is connected to. I can send the URL just fine, and I can load an incoming URL if I know one is there, but it's missing something crucial. There is no way for the u...

cell info when the cell is clicked...

Is it possible to show the cell info when any cell on a worksheet is clicked? For example, if cell A1 is clicked it will show A1, and so on... If yes, can you show example? I need this because I have a c# program which should know which cell was clicked. ...

C#: event with explicity add/remove != typical event?

I have declared a generic event handler public delegate void EventHandler(); to which I have added the extension method 'RaiseEvent': public static void RaiseEvent(this EventHandler self) { if (self != null) self.Invoke(); } When I define the event using the typical syntax public event EventHandler TypicalEvent; then I...

window.opener in safari and chrome

I have a page that creates a popup window, then in the new window i created a new button element and attach a onclick event then attach it to the parent window. var openerDoc = window.opener.document; var newButton = openerDoc.createElement('button'); newButton.onclick = function(){ window.opener.fn(); return false; } var anElement...

Why is this COM interop event not raised whilst running under an STA thread?

Can somebody please explain why the event "OnNewMail" is not raised when using an STA thread in the code below? The program attempts to use the Redemption library to intercept incoming outlook mails. class Program { [STAThread()] // When this line is deleted the application works static void Main(string[] args) { ...

C# Bubbling/Passing Along An Event

How do I pass along an event between classes? I know that sounds ridiculous (and it is) but I've been stumped on this for the past little while. Search didn't turn up a similar question so I figured I would pose it. Here are the objects involved: WinForm -> Speaker -> Tweeter -> Woofer [Speaker, Tweeter, Woofer] a...