event-handling

Java, Design pattern : Multiple event sources and One event Handler

Hello everybody, I want to implement a design in Java where I have multiple event sources (Threads). Such event source accomplish a specific task and had to notify the unique Event Handler (Class) and this one have to accomplish other tasks according to event sources notifications. My question is : how to implement this desiqn in the a...

How to listen to keyboard events in GWT table?

In my GWT program I have a table that has a selected row. I'd like to move the row selection with the up- and down-keys on the keyboard. So I have to catch the key events somehow. The GWT docs handle key events in input fields only. But I don't have an input field! Is this possible at all? Maybe it is a DOM/Javascript restriction that ...

Custom event listener on Android app

Hi everybody, I need to set up a simple event listener to refresh a listview from once in a while. The problem is I don't know how could I generate an event. I know that for events like key or button pressing I just need to implement the handler. But in this specific case I actually need to generate the event, which will be fired everyt...

How do I add and remove an event listener using a function with parameters?

Sorry if this is a common question, but I couldn't find any answers that seemed pertinent through searching. If I attach an event listener like this: window.addEventListener('scroll', function() { check_pos(box); }, false); it doesn't seem to work to try to remove it later, like this: window.removeEventListener('scroll', function() ...

Confirmation before closing

Hi I am using c# .net windows form application. I have a combo box and a text box and a close window button. Now If I make any change in the combo box or textbox and click on the close window button, it should prompt the user to save the modifications.. If no modification are made ( The user will just run the application, doesnt make any...

event args assigning

i have this event handler Temp.MouseLeftButtonDown += new MouseButtonEventHandler(Temp_MouseLeftButtonDown); but i wanna send some parameter to access in the Temp_MouseLeftButtonDown function. how can i assign it ?? ...

(conditional) Multiple Event Handlers C#

A portion of my program requires a "flag" retrieval, that is I am fetching a value that is either True or False, and based on this return value two things could follow. 1) The flag is true, aka "go ahead", and I retrieve data from a database. 2) The flag is false, and I want to prevent the data from being retrieved. Now, this check h...

DataPager EventArgs

I'm using a DataPager control in my silverlight application. I have different pagers for different DataGrids and want to use the same event handler for the PageIndexChanged event for all of them. The delegate must take an EventArgs object as an argument. Can I use this object to "get back" to the control from which the event was fired?...

When designing an event, is it a good idea to prevent listeners from being added twice?

I am creating an event-based API where a user can subscribe to an event by adding listener objects (as is common in Java or C#). When the event is raised, all subscribed listeners are invoked with the event information. I initially decided to prevent adding an event listener more than once. If a listener is added that already exists...

"Rebind" or page_load a usercontrol on a page when a property of the usercontrol is changed in the parent page

Hi all, i have a usercontrol.. and i'd like to set one of it's property's from the parent page and at the same time "reload" the usercontrol so it's updated. formally the usercontrol was picking up a querystring parameter and setting itself up with the querystring parameter.. now i'd like to set this from within the parent page.. open ...

Selecting items from events, as evenly spaced as possible

If I have an event that happens 15 times a second (numbered 1 - 15), but I only want to process it 3 times I can choose [1], [6] and [11],. It's important that the events I process are as evenly spaced as possible and take into account wrap-around, i.e. the events are continuous 13, 14, 15, 1, 2, 3 etc. If I want 4 items the best I can...

How to force SSIS PackageEnd after OnError handler?

I want my SSIS package to stop completely after handling the first error. I have tasks that run in the Package OnError event handler, but then I want the package to exit. Unfortunately, I have not been able to get this to happen. Even worse, when I get a warning, since I don't have an OnWarning handler, it propagates up to OnError, wh...

Using jQuery's animate(), if the clicked on element is "<a href="#" ...> </a>", the fucntion should still return false?

I was reading jQuery's page for animate() http://api.jquery.com/animate/ Its examples don't mention about if using <a href="#" id="clickme">click me</a> ... $('#clickme').click(function() { $('#someDiv').animate({left: "+=60"}); }) we actually still have to return false like in the old days? $('#clickme').click(function() { ...

In Javascript event handling, why "return false" or "event.preventDefault()" and "stopping the event flow" will make a difference?

It is said that when we handle a "click event", returning false or calling event.preventDefault() makes a difference, in which the difference is that preventDefault will only prevent the default event action to occur, i.e. a page redirect on a link click, a form submission, etc. and return false will also stop the event fl...

Microsoft Workflow - "Event cannot be delivered"

I have strange problem. My application is using Windows Workflow Foundation. It is simple app that creates requests and then other presons accepts/denies these requests. Everything was working very fine until my client took application to other servers (app and db). From this time WF instances are created in DB but when app tries to fir...

How can I add an onclick handler on a dynamic element?

Here is the important part of my JS code: function createClose() { var cButton = document.createElement("img"); cButton.src = "close.gif"; cButton.style.cursor = "pointer"; cButton.onclick = closeWindow; document.getElementById("my_window").appendChild(cButton); } function closeWindow() { document.getElementById("my_window...

Thread raising event gets blocked by handlers?

I am raising an event from managed C++ which is handled by a C# app. Is the C# event handler executed on the same thread it was raised from C++ ?? In other words, Is raising event blocking for C++ until it is completely handled by C#? ...

Best practice regarding the 'object' parameter of event.

This question is only related to the first parameter in any event handler, that is 'object'. I am just curious to understand the best practice that should be adopted while raising an event. The case is simple when the event is originated from my object itself, in that case i can simply call... RaiseSomeEvent(this, someArgs). What shou...

Using threads and event handlers within a WCF Web Service

While making a WCF Web Service, I came across a problem while using a method with a webbrowser control. The method starts a thread and uses a webbrowser control to fill in some forms and click further, waiting for a event handler to fire and return a answer I need. The method is tested and works within its own enviroment, but used in a W...

C# Event Handlers automatically created by WinForms Designer

Just moved from VB.NET to C#. In VB to connect and Event Handler to a Sub we use the Handles clause. From what it seems, this do not exist in C#. After creating a simple application with a button I realize that Window Forms Designer automatically created an EventHandler to my button1_Click function (after I double clicked it), in For...