event-handling

add handler by reflection using EventArg inheritance

In .Net 4 this code run with no error class A { public event EventHandler<CustomEventArgs> MyEvent; } where CustomEventArgs derived from EventArgs void Test() { A a = new A(); a.MyEvent += MyFunc; } void MyFunc(object sender, EventArgs args) // EventArgs expect of CustomEventArgs { } Now, when I try to do the same by reflect...

How to install and handle the event filter to Qt graphicsview

Hi, i have a graphicsview and graphicsscen but i don't no how to install and handle the event filter for getting the keyboard events. i appreciate your help regarding the same. Thanks in advance. ...

How to release objects stored in an array?

Please look at the code below and suggest the best approach. I can't quite tell whether the code is correct. When adding objects to arrays, do they get a retain count? In the second function, am I releasing the local variable "mySubview" or the original object? // this is a class property myArray = [[NSMutableArray alloc] init]...

Firing custom events / General event handling

I'm getting into event handling now, and it seems quite confusing to me. See, I come from a web-dev background, so this event stuff is quite new to me. I'm developing in C# / VS08 and created my Application in the WinForm-Designer. Now, I created this program overview; ProgramContext MainForm : Form LoginForm : Form So, what I wan...

C#, simplified code to handle both changes and updates of a dependency property

Obviously, I'm not an expert in C#. I would like to simplify this code by using an anonymous handler, or maybe a lambda, not sure. ValueHasChanged is a PropertyChangedCallback used when a dp is changed, it ensures the new object will be monitored for update, so that both changes and updates will be processed using the same code: ProcessN...

KeyPreview not handling KeyUp Event before control does.

I have a form, myForm, which has KeyPreview set to true. The idea is that I want to capture CTRL-Enter and fire the submit button of the form, no matter what textbox (or other control) that may have focus. So I set up this method: private void myForm_KeyUp(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.Enter) ...

Why does Multibinding have NotifyOnTargetUpdated but no TargetUpdated property

I've run into a problem where the TargetUpdated event seemed like it would be perfect. Unfortunately it looks like Multibinding does not have a TargetUpdated property. Is there some way to still set this up or do I need to find another solution entirely. Heres some code to help Heres the binding... <RotateTransform x:Name="LeftNeedle"...

Why do event handlers always have a return type of void?

Hey, I wondered why is it that the return type of events such as private void button1_Click(object sender, EventArgs e) always void? can it return any value too? ...

jQuery Cycle - Multiple instances of plugin; onclick does not pause

Hi all, I'm writing my first real bit of jQuery, so bear with me here... What I'm doing is this: Creating 12 instances of the Cycle plugin (the feature is a grid of product images) Within a repeating interval: pausing all instances of cycle, choosing 2 at random, and resuming those. So at any one time, there's only 2 active instances...

What is the best practise to not to override other bound functions to window.onresize?

How much I dig into JavaScript, I find myself asking that much. For example we have window.onresize event handler and if I say: window.onresize = resize; function resize() { console.log("resize event detected!"); } Wouldn't that kill all other functions which is connected to the same event and just log my message in console? If so...

How to make tkinter repond events while waiting socket data?

I'm trying to make the app read data from a socket, but it takes some time and locks the interface, how do I make it respond to tk events while waiting? ...

How do you display a confirmation dialog before printing from any application?

Hi Guys I'm currently trying to set up a kiosk environment in our reception area and one of the requirements is that when a user tries to print from any application, they receive a confirmation dialog box which lets them know what the cost to print will be along with the option to continue or cancel the job. It would be nice if there w...

Raise custom events in C# WinForms

I have some Events I created on my own and was wondering on how to raise them when I want. Probably my application design is also messed up, might take a look at that if you like. This is the Structure ProgramContext - Form MainWindow + Control TextBox + Control Button + ... In this case, the MainWindow.TextBox holds some inf...

[jQuery] Removing event handlers of children

I am trying to unbind event handlers (click) from all a-tags, and somehow it is not working. Do you guys know why? // Remove eventhandlers row.find('a').each(function(){ $(this).unbind('click'); alert($(this).attr("onClick")); }); It will always output the current onClick function. Thanks ...

Prioritising Event Handlers

I have the following code where I am handling an event twice. However I always want to ensure that mynewclass always handles the event first and then the local event handler code fires. I understand the MyClass event should fire first as that is the one created first but because the thread and enqueuing is taking place, I think its tak...

OpenFrameworks/POCO Events not being listened?

Hello all, I'm having some problems with OpenFrameworks Event system, which is based on POCO's. I'm registering an event with ofNotifyEvent(ofEvent event) and definining the event listener with ofAddListener(ofEvent event,ListenerClass instance, ListenerMethod method) The class I'm registering as listener is never called when ofNotify...

Found a bug in CDHTMLDialog DHTML_EVENT event handling?

There seems to be a bug in the CDHTMLDialog class. I'd appreciate if anyone could either confirm or correct me here. I've created a wrapper for CDHTMLDialog, where users can enter a custom html text, it will be formatted in a particular manner, and displayed along with an html button to close the dialog. I'm catching the html button pre...

not understanding event-delegation with jquery ui tabs

I'm just not getting event delegation with jquery ui tabs, or at all! I got the code for jquery ui tabs and loading the pages with ajax working perfectly. However I'm having trouble understanding event-delegation. I load 4 tabs with external content, depending on the tab which is opened. Inside those tabs I would like to attach the s...

what's the best practice for events handling in MVVM

I am doing a silverlight using the MVVM model, and i am finding it hard to do the events handling via MVVM especially that the events handlers are doing lots of changes in the view like enabling and disabling buttons, update media element functions and position. I am still new to the MVVM and i can't Imagen how can i do this. does anyo...

Handle Button Click Event from User Control loaded dynamically

Hello. I have a blank user control (child) and during Page_Load i create some text boxes and a button. I also add an event to the button. I then load that user control dynamically from a placeholder in another usercontrol (parent). Both controls are rendered correctly but when i click on the button, the event isnt fired. Any ideas on h...