events

Any efficient/reliable way to expose one event?

Any efficient/reliable way to expose one event? I have a class, MultipleDocumentCopier that copies multiple documents thru an instance of SingleDocumentCopier. SingleDocumentCopier exposes an event CopyCompleted that is fired when a file is copied. Suppose that, I am copying 10 files, instead of raising SingleDocumentCopier.CopyComplet...

What is IDataErrorInfo and how does it work with WPF?

While working on some custom validators in WPF, one of my co-workers pointed me out the IDataErrorInfo. I have a sample view in XAML that has a textbox and a button. Based on the value in the textbox I would like the button to be either enabled or disabled. My co-worker suggested that extending the IDataErrorInfo in the presentor of my v...

C# Attaching Eventhandler with New Handler vs Directly assigning it

Hello, I was just wondering what the actual difference, advantage and disadvantages of creating a new event handler, vs assigning it directly to the event ? _gMonitor.CollectionChanged += new NotifyCollectionChangedEventHandler(OnCollectionChanged); vs _gMonitor.CollectionChanged += OnCollectionChanged; Thanks, Raul ...

How to prevent subscribers to an event from conflicting with each other?

Say I have an event with 2 subscribers (everything occurs in the same thread) - one subscriber writes to a log file, the other shows a MessageBox. If the MessageBox is the first on the subscription list, then the log entry is not written until the after the user closes the message box. So the time in the log entry will really be the ti...

How can I pass addition parameters to my centralized event handlers?

In a WPF application, I've got my events centralized in one class like this: public class EventFactory { public static void Button_Edit_Click(object sender, RoutedEventArgs e) { MessageBox.Show("you clicked edit"); } public static void Button_Add_Click(object sender, RoutedEventArgs e) { MessageBox.S...

Fire mouse event on underlying components

I'm looking for a way to pass mouse events to components covered by other components. To illustrate what I mean, here's a sample code. It contains two JLabels, one is twice smaller and entirely covered with a bigger label. If you mouse over the labels, only the bigger one fires mouseEntered event however. import java.awt.Color; import j...

How provide own Sent Messages in Interface Builder

I cannot find documents about the way, in which Interface Builder determines the Sent Message outlets for the graphical connections between components triggering events and messages of other components. I want to generate components encapsulating Finite State Automata. The input part is simple, just define IBAction messages and you can c...

WPF - Catch a CLR event in A Style template

I have a style for a ListBox. In the listbox style I have a style for the ListBoxItems. All of this is in the section. I want to catch the IsEnabledChanged event for the Listbox Items (see this question for why). I tried setting up an EventSetter, but it can't see the event because it is not a "routed event". How can I attach an ev...

Fire event when switching stacks of StackLayoutPanel in GWT 2.0

I'm trying to catch an event, when I switch the stacks of a StackLayoutPanel in GWT 2.0. The biggest problem is that I don't know which event gets fired and there seems to be no documentation, I have added a ChangeHandler with addDomHandler() but that hasn't worked. Unfortunately the StackLayoutPanel doesn't implement the getSelectedInde...

WPF: how to signal an event from ViewModel to View without code in codebehind?

Hi, I have quite simple (I hope :)) problem: In MVVM, View usually listens on changes of ViewModel's properties. However, I would sometimes like to listen on event, so that, for example, View could start animation, or close window, when VM signals. Doing it via bool property with NotifyPropertyChanged (and starting animation only whe...

What event fires if Excel VBA code execution is prematurely ended?

Is there an Excel Application or Workbook event that fires if code execution is ended from a run-time error? I use Application.Interactive = False at the beginning of some of my procedures. If the code execution stops before Application.Interactive = True at the end of the procedure, then the user gets locked out of the Excel. I don't ...

Throwing events through objects

Hello! I'm developing a Windows Mobile 5.0 or above application with .Net Compact Framework 2.0 SP2 and C#. I have a Winform (Form1) with a control (Control1) that contains another control (Control2). For example, a winform with a panel and inside this panel there is a button, but in my case Control1 and Control2 are custom controls. ...

JavaScript, DOM blur/focus, dropdowns

I am building a rich text/wysiwyg editor component in HTML and JavaScript. I have an unordered list of toolbar items which contains an image input element for a colour picker. The colour picker is an overlay which is displayed on the click event of the input element. The problem: I want the colour picker overlay to hide when focus is l...

JQuery UI Tabs - dynamically adding and removing mouseover event

I would like to add a mouseover event to a UI tab strip when user clicks on a checkbox, but I am trouble dynamically adding and removing events. Here is what I have so far. <script type="text/javascript"> $(function() { // add mouseover event when user clicks on checlkbox called chkbEnableMouseOver $("#chkbEnableMouseOver").ch...

jQuery how to have a event only triggered once on clicking a div

This is probably pushing the limits of jquery. I want to have the live() event triggered. But I only want to let it be triggered once using perhaps the one() event. Currently I have the code blow. How do I restrict this to only being called once. $(".sub-content").live('click', function() { var id = this.id; $.get("InfoRetriev...

WPF: How to prevent a control from stealing a key gesture?

In my WPF application I would like to attach an input gesture to a command so that the input gesture is globally available in the main window, no matter which control has the focus. In my case I would like to bind Key.PageDown to a command, however, as soon as certain controls receive the focus (e.g. a TextBox or TreeView control), thes...

outlook plugin to catch compose mail events

I got an adjoining formregion in the compose mail form and i dont find the way to intercepts the form events like the drag and dropping of a file inside the message or the insertion of a text. NB: Ms has forbidden the complete replacement of the compose mail form so i cannot re-write the form has i want ...

Event interferes with subroutines

I'm struggling with an event related to my communications class. I'm calling a 'DataChange' function via event handler any time I receive new data over my serial connection. I then proceed to load that data into a DataGridView, perform some formatting, etc for the users. I'm getting a ton of problems due to the frequency at which the Da...

Pitfalls of Event Handling in Java

I'm working on a program that needs a Java object to have an event. I'm quite familiar with how this works in C#, having had enough experience to learn the pitfalls. What are the pitfalls of working with events in Java? How are they different from events in C# 2.0? Example: An object changed event to prompt a save from the owner ob...

Is this the best way for me to set events for my controls?

I'm setting them during runtime, I'm kinda afraid that this will bog down my application eventually. Is there a better way? public MainForm() { InitializeComponent(); SetPictureBoxEvents(); } private void SetPictureBoxEvents() { Andromeda.MouseEnter += new EventHandler(HeroMouseEnter); ...