events

Testing that an event has an EventHandler assigned

Hi, I'm wanting to test that a class has an EventHandler assigned to an event. Basically I'm using my IoC Container to hook up EventHandlers for me, and I'm wanting to check they get assigned properly. So really, I'm testing my IoC config. [Test] public void create_person_event_handler_is_hooked_up_by_windsor() { IChangePersonSer...

Exposing events from .NET to COM

Hello everyone, recently I have been encountering problems with exposing events from .NET to COM. I have been successful with this example (conceptually taken from http://blogs.msdn.com/andreww/archive/2008/10/13/exposing-events-from-managed-add-in-objects.aspx): // The delegate type for our custom event. [ComVisible(false)] public de...

C# MouseEventArgs "e.Delta" not working

Hi I have an MDI application where a child window handles a number of mouse events. Everything has worked no problem (e.Button, e.Location, etc) until I tried to get the value from e.Delta (number of mouse detents). e.Delta always returns 0. My events are trigger no problem, just the value of e.Delta is always zero while everything els...

Handling key-press events (F1-F12) using JavaScript and jQuery, cross-browser

I want to handle F1-F12 keys using JavaScript and jQuery. I am not sure what pitfalls there are to avoid, and I am not currently able to test implementations in any other browsers than Internet Explorer 8, Google Chrome and Mozilla FireFox 3. Any suggestions to a full cross-browser solution? Something like a well-tested jQuery library ...

How to create custom MouseEvent.CLICK event in AS3 (pass parameters to function)?

Hello, This question doesn't relate only to MouseEvent.CLICK event type but to all event types that already exist in AS3. I read a lot about custom events but until now I couldn't figure it out how to do what I want to do. I'm going to try to explain, I hope you understand: Here is a illustration of my situation: for(var i:Number; i <...

Design of a polling event API

Say you were designing a C++ windowing library. It may or may not provide a callback API, but needs to provide a polling API to facilitate a functional style of programming. What would the polling API look like? Some options SDL style struct Event { enum { MousePress, KeyPress } type; union { struct { Point pos; Mouse...

Using event of control under datalist

I have a datalist control which some controls(ex: button) are in it. I want to write some code into click event of button which is in the datalist control. But in the code behind page I can't see the name of controls into datalist. How can I solve this problem? ...

Properly notifying all listeners of a system wide named manual reset event and then immediately resetting it

I have a system-wide manual reset event that I create by doing the following: EventWaitHandle notifyEvent = new EventWaitHandle(false, EventResetMode.ManualReset, notifyEventName, out createdEvent); Several processes create this event (e.g. it is shared amongst them). It is used for notifying when something gets updated. I'd like to ...

Is there any events based calendar that is available for ASP.NET

Hi i am looking for an events calendar where user can come in and add their events.. and then latter on other ppl can view it... what i am looking for is something like this.. http://www.torontoparentsguide.com/Events/tabid/92/Default.aspx ...

How can I hook into the current FormsAuthenticationModule in a Medium Trust environment?

I've got an HttpModule in my application that hooks into the FormsAuthenticationModule's Authenticate event with the following code: public void Init(HttpApplication context) { FormsAuthenticationModule faModule = (FormsAuthenticationModule)context.Modules["FormsAuthentication"]; faModule.Authenticate += new Form...

Javascript: Is it possible to get hold of the mouse position outside of an event handler?

I want to get hold of the mouse position in a timeout callback? As far as I can tell, this isn't possible, though one work around might be to set an onmousemove event on document.body when one needs this information and to save this position somewhere. This would be rather expensive however, and is rather hackish. ...

c# - assigning methods to dynamically created controls

Hi, I'm designing an application that supports plugin development. Its more of a learning exercise. I've come across a problem I don't know how to solve. All of the assemblies (plugins) being loaded into my app contain a showPrefs() method. As I load each assembly, I want to assign a button to each one so that when I click on the butt...

Delay jquery hover event?

I would like to delay a hover event in jquery. I am reading from a file when user hovers over a link or label. I don't want this event to occur immediately in case the user is just moving the mouse across the screen. Is there a way to delay the event from firing? Thank you. Example code: $(function() { $('#container a').hover(f...

Events in Java?

I'm a bit confused from what I've heard Java doesn't do events. But I know that it does GUI events. Am I missing something? Does java have an event handling mechanism? I'm aware that I can implement a publisher subscriber pattern, but I'm lookign for native support within Java. I seem to remember something about Java Adding events in...

What's the best way to get the DropDown event of a ComboBox in a DataGridView.

Say I have a DataGridView in which I dynamically build up a ComboBox column and add values to it. What's the best approach to trapping when the user clicks on the drop down button to show the drop down list. If I simply use CellClick on the DataGridView, I get that event even if the user doesn't actually click on the drop down button. S...

How to unregister an event handler in Internet Explorer 6?

I am registering a function with the onload method of a html form, I need to unregister this event hander function on unload of the form. How do I do it in Internet Explorer 6? ...

How to execute ruby script on some event?

Hi, everyone! I want to execute another ruby script from my Shoes app. I try button "..." do `ruby -rubygems /Users/kemiisto/Desktop/Ruby/gears.rb` end but nothing happens. In the case of other commands, for example button "..." do `open /Applications/TextEdit.app/` end all works fine. Any ideas? ...

EventHandlers and Anonymous Delegates / Lambda Expressions

I'm hoping to clear some things up with anonymous delegates and lambda expressions being used to create a method for event handlers in C#; for myself at least. Suppose we have an event that adds either an anonymous delegate or lambda expression [for you lucky crowds that can use newer versions of .NET]. SomeClass.SomeEvent += delegate...

How do I assign Enter as the trigger key of all JButtons in my Java application?

I'm writing a Java Swing application using the Metal look-and-feel. Every time there is a JButton in my application the user uses the Tab key to move the focus to the button and then hits the Enter key. Nothing happens! If he hits the Space key the button events are fired. How do I assign the Enter key to trigger the same events as the S...

How to duplicate one element's event handlers onto another?

How do you copy an event handler from one element to another? For example: $('#firstEl') .click(function() { alert("Handled!"); }) ; // here's where the magic happens $('#secondEl').click = $('#firstEl').click; // ???? Note that the second element is being processed at a different time to when the first element is ge...