event-handling

Flex Drag & Drop: Detecting when all data has been moved from source to destination

I have two mx:TileList controls that I'm using to allow editing of objects in batch. The first contains a collection of all available data, and the 2nd contains the current batch. Both are bound to ArrayCollections, and using the native drag-n-drop functionality of the TileList control the data is moved from one ArrayCollection to the ot...

Implement an event for a change in a SortedList

Hello, I'm hoping the answer is as simple as the question, but I need to write an event for a class that implements a SortedList. Is there a way I can create an event handler for anytime this list changes (Add, Modify, Remove)? The Add() methods and such are not override-able. Thanks! ...

What's the most elegant way to swap out events when setting a property?

Doing component-based development, I find myself doing this fairly often: public class SomeClass { SomeOtherClass foo; public SomeOtherClass Foo { get { return foo; } set { if (value != foo) { if (value != null) { // subscribe to some events ...

c# How to send an array with an event?

Hi! I have this array with information string[] aInfo; // Contains information about this person I have a clickevent on a menuitem that goes like this: // Event for adding contact mContact.Click += new EventHandler(addContactMenuClick); Then further into the project i have the eventhandler: // Eventhandler for adding ...

Javascript GUI issues with event bubbling

I am trying to setup a fairly simple (imo) Javascript GUI, and am running into issues. I'm using jQuery. Here's what I want to do: Have a bunch of squares next to some text, like this: [ ] Text next to square [ ] Text next to square 2 [ ] Text next to square 3 [ ] Text next to square 4 When you click one of the squares, an absolutely...

Titled frame panel for GWT (using FIELDSET and LEGEND html tags)

I'm trying to create a titled border frame in GWT, which results in this: This can be done using HTML fieldset and legend tags, such as <fieldset> <legend>Connection parameters</legend> ... the rest ... </fieldset> I want to create a custom widget in GWT that implements that. I managed to do that, but the problem is that e...

Using an EventHandler to detect a variable change?

How would you recommend I setup an event handler to fire when a variable is updated with a value > 0. public _price; public double GetPrice(string item) { _table.GetData += new EventHandler<EventArgs>(ExtractData); // Right now I set it to sleep to give it enough time to return the data. // But I would like to setup an eve...

Unobtrusive Javascript Obfuscates Event Handling

You know what I liked best about obtrusive javascript? You always knew what it was going to do when you triggered an event. <a onclick="thisHappens()" /> Now that everybody's drinking the unobtrusive kool-aid it's not so obvious. Calls to bind events can happen on any line of any number of javascript file that get included on your pa...

VB.NET: Building an Event Manager - Listeners

I'm in the research stage of a project that will require the development of a custom event manager for computer game events. In the past, the routing code for polling the correct pieces of code for event consumption has been placed entirely within the Event Manager's ProcessEvents() function. Example: The UI needs to be provided the o...

C# dynamically add event handler

Hi i have a simple question. here is my code: XmlDocument xmlData = new XmlDocument(); xmlData.Load("xml.xml"); /* Load announcements first */ XmlNodeList announcements = xmlData.GetElementsByTagName("announcement"); for (int i = 0; i < announcements.Count; i++) { ToolStripMe...

Subscribe to events within a WCF service

I have a need to do some real-time rpoerting on the functionality of a WCF service. The service is self-hosted in a windows app, and my requirement is to report "live" to the host app when certain methods are called by the client. My initial thought on the task was to publish a "NotifyNow" event in the service code, and subscribe to th...

How events like CancelEventArgs can be used?

Ho can the event System.ComponentModel.CancelEventArgs be used? Suppose we have the following code: public event CancelEventHandler EventTest = delegate { }; public void MakeSomethingThatRaisesEvent() { CancelEventArgs cea = new CancelEventArgs(); EventTest(this, cea); if (cea.Cancel) { ...

Wire _KeyDown event of textbox to a _click event of button control

I have a form with a textbox called 'tbWO.' This field is used to enter a Purchase Order Number. I also have a button control called 'btnFill.' When btnFill is clicked, it fills a dataset with a parameter from 'tbWO.' I would like to be able to press 'ENTER' in the 'tbWO' textbox (after a Purchase Order # is entered) and have it fire...

ASP.Net (Web-forms) Page Lifecycle Problem - distinguishing between form loading, datapaging and command events.

I'm working on a sortable listview with data-paging. I've got the listview and paging working fine, but I'm struggling with with the sorting. The sorting in itself is fine; I can sort by a particular column (ASC or DESC), however I'm having problems when it comes to dynamic sorting where the user can pick a column and, at times, reverse ...

How can I apply an event to a simple link element in ASP.NET

I have an <asp:Image> element and a text caption, surrounded by an <a> element. I need the link to run a method when clicked, changing the ImageUrl property of another <asp:Image> element. I'm a total noob with ASP.NET (Clearly.) Can anyone explain this process to me? ...

Action<object, EventArgs> could not be casted to EventHandler?

I was wiring up an event to use a lambda which needed to remove itself after triggering. I couldn't do it by inlining the lambda to the += event (no accessable variable to use to remove the event) so i set up an Action<object, EventArgs> variable and moved the lambda there. The main error was that it could not convert an Action<object, E...

How to declare and consume events in Java

I have a simple class - will call it Animal. I'd like to fire off an event in the Animal class and have it handled in the class where I instantiated the Animal class. In the event handler, I want to pass an Integer value How do I pull off something simple like that? ...

how to handle push notification if application is already running?

how do we handle push notification if app is already running? means i want to show an alert if app is running instead of push notification alert.if app is not running then show push notification alert.also tell me that if i send a payload to APNs how do i cancel the payload? ...

Am I using the right approach to monitor the tasks I want to perform when a handle is created?

Is there a generally-accepted best practice for creating an event handler that unsubscribes itself? E.g., the first thing I came up with is something like: // Foo.cs // ... Bar bar = new Bar(/* add'l req'd state */); EventHandler handler = new EventHandler(bar.HandlerMethod); bar.HandlerToUnsubscribe = handler; eventSource.EventName...

ASP.NET Tree Control - Cannot re-expand tree on reload

I have the following code to delete a company displayed in my ASP.NET 2.0 Tree control: protected void Delete_Click(object sender, EventArgs e) { TreeNode parentNode = null; int expandDepth = 1; string companyID = ""; expandDepth = companyTree.SelectedNode.Depth; if(companyTree.SelectedNode.Parent != null) p...