event-handling

Is it safe to use the same event handler for different Windows Forms Controls?

Is this good practise? I have 3 DataGridView's and I want to have a facility that allows a user to sort the data by clicking on a column header. I could've had an event handler for the ColumnHeaderMouseClick event for each of these DataGridView's, but instead I made one: private void dataGridView_ColumnHeaderMouseClick(object sender, D...

Create, test, and raise a copy of public event's in an event handler to safeguard against exceptions in subscribers

I see alot of code that just calls the eventhandler like so: if( OnyMyEvent != null) OnMyEvent(this,"args"); But in this article C# Event Implementation Fundamentals, Best Practices and Conventions By Jeffrey Schaefer: 7) Event Raising Code on CodeProject he describes a way to raise events so that exceptions subscribers doesnt af...

Flash AS3 problem with eventListener

Hello, I'm having problem with listening to an event dispatched from a child class, and I don't know why? I have to classes: class 1, witch draws a rectangle and dispatches a custom Event package { import flash.display.; import flash.events.; import flash.text.*; public class clase1 extends Sprite { private var labelField...

Syncronizing 'radiogroups' with jQuery

Hi all! Let there be two - identical in terms of options - radio groups A and B. I'm trying to guarantee, via jQuery, that if some option is selected in A, then it's equivalent option is selected in B, and the other way around. My current approach is this one: $(document).ready(function() { $(".groupA > input").click(function() { ...

wxPython: Handling events in a widget that is inside a notebook

I have a wxPython notebook, in this case a wx.aui.AuiNotebook. (but this problem has happened with other kinds of notebooks as well.) In my notebook I have a widget, in this case a subclass of ScrolledPanel, for which I am trying to do some custom event handling (for wx.EVT_KEY_DOWN). However, the events are not being handled. I checked ...

alternative for waitForPageToLoad in Selenium

I have a series of links on a page that take different times to load... I want to capture the amount of time each takes... The problem I am having is that the waitForPageToLoad time if exceeded causes the test to fail and the rest of my links do not get tested... I know I could just skip suspected links in the test or set the time limit...

Combobox SelectedItemChanged event in a User Control

I have a user control consisting of a combobox and a label. In my application I need to enable or disable some other controls based on the selected value in that combobox. How do I access the SelectItemChanged event from the application? ...

How to fake an event in mootools?

Sample code: <div id="first">first div</div> <div id="second">second div, click here or on the previous it's the same</div> Suppose I set an event onclick on the first div that alerts the div's content. How do I call that event? In example clicking on the second div I'd like it to call the click event of the first div and alert('firs...

Extjs radio addevent problem

Hi ; i'am add radio buttons on click event. but not working. my code : RadioPanel : RadioPanels = new Ext.Panel({ layout: 'table', id: 'newRadioEdit', name: 'newRadioEdit', //title:'Servis Durumu', bodyStyle: Ext.isIE ? 'padding-left:35px;' : 'padding-left:35px;...

Flex 3 keyboard event handling

I'd like to arrange things so that I have a chain of keyboard event handlers in my flex application, all of whom are queried when key down events occur. Basically, when a visual component is on screen, it is a candidate for handling a key press event. Something like this (clearly this is pseudocode): <application handles_keys="F5, F6"...

dojo.disconnect question

How do you remove a dojo connected event if you do not have the "handle" that was returned during the dojo.connect? My example involves dynamically assigning a set of events to a set of objects. (for simplicity, the events are onclick and ondblclick, and the objects are rows within a table) So, during page setup events are connected ...

How can I track when multiple events have occured?

I'm writing a plug-in for a program where I need to track when native objects are added, removed, and edited in the active document. The API has events that are fired when the document is edited. However, the program does not track when the native objects actually change. Instead an object changing is treated as the object being deleted ...

How can I tell when the last of series of events are envoked?

I'm writing a plug-in for a program where I have a custom user control with a TreeView. When the user selects or deselects objects in the native program ObjectSelected and ObjectDeselected events are evoked. When these events are fired my program will select or deselect corresponding nodes in the tree view. The problem is this is a grap...

Anonymous methods - C# to VB.NET - Warning, this is a doing my 'homework' like question.

I am sorry to ask this on here as I know it is like doing my homework for me but I have a very urgent requirement to implement a single VB.NET instance of an application on a terminal server. To do this I am using code from the Flawless Code blog. It works well, except in the code is written in C# and uses an anonymous method which is no...

User control added dynamically to a WinForm doesn't fire its inner controls events

I have a user control which has several radiobuttons and buttons... I have code to handle button's click events and radio button's CheckedChange event. After adding this userControl dynamically to a Form panel, I notice the events of the inner controls are not firing. I'm doing a "new" of the user control, and adding it to the Controls...

flex button event listeners in Class

Hi, I have many buttons in Main.mxml. I'm trying to move the button functionality into a Class and have Event Listeners inside the class respond to Click and call other functions. I have written: Main.mxml <mx:Button x="23.5" y="10" label="checker" click="{goListen()}" /> <mx:Button id="btnT1" x="252.5" y="10" label="t1" /> <mx:Button ...

Javascript sending key codes to a <textarea> element

Hi, I can't figure out how to trigger a keydown event on a textarea element, e.g. imagine i have two textarea elements and when i type something in the first one, I want the second box to show the typing as well, but for a certain reason I have to do it via events. This is what I tried and it doesn't work: <script language="javascript"...

Is it possible to avoid multiple button clicks on a Winform?

Suppose you have a button on a form that counts to 1000 in a textbox and then clears it. If I quickly click the button five times (in runtime) the Click event handler will be called 5 times and I will see the count to 1000 five times. Is it possible to disable other clicks on that button while the first click is counting? Note: Disab...

In C#, why can't i test if a event handler is null anywhere outside of the class that it's defined?

I'm sure that i'm just not understanding something fundamental about events and/or delegates in C#, but why can't i do the Boolean tests in this code sample: public class UseSomeEventBase { public delegate void SomeEventHandler(object sender, EventArgs e); public event SomeEventHandler SomeEvent; protected void OnSomeEvent(E...

Which methods can be used to make thread wait for an event and then continue its execution?

I have a thread running that delegates out some tasks. When a single task is complete, an event is raised saying that it has completed. These tasks need to be run in a specific order and need to wait for the previous task to finish. How can I make the thread wait until it receives the "task completed" event? (Aside from the obvious event...