event-handling

Javascript event handlers always increase browser memory usage

Edit: On further examination Firefox does not seem to be doing this, but Chrome definitely does. I guess its just a bug with a new browser - for every event an I/O Read also occurs in Chrome but not in FF. When I load the following page in a browser (I've tested in Chrome and Firefox 3 under Vista) and move the mouse around the memory a...

How do I keep events elements added through a ajax call in jQuery "active"

I'm placing content on my page through an ajax (post) request like so: $("input#ViewMore").click(function() { var data = { before: oldestDate, threadId: 1 }; $.post("/Message/More", data,function(html) { $('tbody#posts').prepend(html); return false; }, "html"); return false; }); with th...

Java - Handle multiple events with one function?

First of all, I am a complete Java NOOB. I want to handle multiple button presses with one function, and do certain things depending on which button was clicked. I am using Netbeans, and I added an event with a binding function. That function is sent an ActionEvent by default. How do I get the object that was clicked in order to trigge...

Why does the "onmouseover" event use "return true" to prevent default behavior?

I have been searching for this for some time, but haven't got any explanation. For "onclick" and other events in javascript, the event handler returning false means "prevent default action". However, there is one exception for "onmouseover". For "onmouseover", returning true means "prevent default action". Why is there such a weird exc...

Best practices for passing data between processes in Cocoa

I am in the middle of solving a problem which requires me to do the following in my 64-bit Cocoa application: Spawn a 32-bit Cocoa helper tool (command line tool) from within my application. This helper will open a file (a quicktime movie to be precise) and access information about that file using 32-bit only APIs (Quicktime-C APIs) T...

Is it necessary to explicitly remove event handlers in C#

I have a class that offers up a few events. That class is declared globally but not instanced upon that global declaration--it's instanced on an as-needed basis in the methods that need it. Each time that class is needed in a method, it is instanced and event handlers are registered. Is it necessary to remove the event handlers explici...

Common Event Handlers in VB.NET

I have around 10 buttons on my form and I want them to call the same Click event handler. But for that I need the Event handler to be generalized and we don't have "this" keyword in VB.NET to refer to the control that caused the event. How do I implement the functionality of "this" keyword in VB.NET? I want to be able to write an Even...

Events and Event handling in VB

I have a web user control which my aspx page contains. During testing I discovered a exception being thrown. (The general rule that is in place, is that when an exception occurs the user is redirected to a excpetion page detailing the error) Once the excpetion was handled in my User Control I wanted to throw it to the page where the pa...

Handling events from HTML anchor tags in ExtJS

I have a large application built in ExtJS and am looking for the best way to handle custom events from anywhere in the application. For example I might want to put an anchor tag in some text in the application which will open a custom component in my app. At the moment I listen to clicks on the body and if the target has a css class appl...

jQuery: $().click(fn) vs. $().bind('click',fn);

When using jQuery to hookup an event handler, is there any difference between using the click method $().click(fn) versus using the bind method $().bind('click',fn); Other than bind's optional data parameter. ...

How to manually raise an event by supplying X, Y and Windowhandle parameters?

We are working on a module in which I gave the xpos, ypos, windowhandle. Now what I want to do is I want to raise the event for the corresponding input on (xpos, ypos, windowhandle). For example: The input given is to select a file means it will select a file automatically through my module. 00010086 PWM_LBUTTONDBCLK fwKeys:MK_LBUTTON...

Passing eventArgs to javascript from ASP.NET C# from OnClientClick

Hi, I have an asp button on my page, in the Page_Load on the code behind, I am binding some javascript calls as follows. btnExample.OnClientClicking = "functionOne(1,2);"+"function2()"; The problem is I would like to be able to pass the EventArgs passed to the Page_Load as in function2() I wish to call... eventArgs.set_cancel(true)....

Can I handle a key up event even when grid view isn't focused?

I have a Data Grid View inside a control that is displayed in a certain area in an application. I'd like this activity grid to refresh when F5 is pressed. It's easy enough to do this when the Activity Grid View is the currently focused element on the screen by handling the Key Up event, but this obviously doesn't work when another elem...

In Dojo or Javascript how do I make my event handler fire before other event handlers?

In the Dojo Javascript library, I understand how to use dojo.connect or dojo.publish to wire up my event handler to an event. That functionality works great. But I want to do one additional thing. I want my event handler to fire first, before any other already defined event handlers. I suppose this could be called "event handler inse...

How to determine the total number of "initProgress" events coming from the preloader?

The flash preloader emits FlexEvent.INIT_PROGRESS events to signal the progress of the flash application initialization. However, the number of times this event is dispatched depends on the application itself. I am trying to determine this number, but I couldn't find an answer in the Flex documentation, so right now I resort to experime...

What is the preferred method for event handling in C#?

Which is the preferred/recommended way of handling events in .NET: this.Load += new EventHandler(Form1_Load); private void Form1_Load(object sender, EventArgs e) { } or protected override void OnLoad(EventArgs e) { base.OnLoad(e); } What would the pros/cons of each method be? I've used both methods over the years, and have usua...

JQuery event.target error

Hi, I've a box from divs (price_item) with several child divs (date, price etc.). I'm using it as a caroussel for showing prices. If one clicks on any child, the parent's background color must be changed to red. I wrote it like: $(...selectquery...).click(function() { var $tgt = $(event.target); $tgt.parent().css("backgroundColo...

C#: Difference between ' += anEvent' and ' += new EventHandler(anEvent)'

Take the below code: private void anEvent(object sender, EventArgs e) { //some code } What is the difference between the following ? [object].[event] += anEvent; //and [object].[event] += new EventHandler(anEvent); [UPDATE] Apparently, there is no difference between the two...the former is just syntactic sugar of the latte...

Dynamically creating a sub-menu in Delphi

I have a popup menu and I want one of the items to open a sub-menu with a dynamically created list (it's a list of user defined flags). Here's how I'm creating the menu items (FlagAs is the menu item I want to attach the sub-menu to): lNewMenuItems: array[0..flagCount] of tMenuItem; for I := 0 to flagCount do begin { Create a new men...

C# adding and removing events from a timer

I am trying to add and remove events from a timer and I have the following code: Timer myTimer = new Timer(); // Windows.Forms Timer public void addEvent(MyDelegate ev) { myTimer.Tick += new EventHandler(ev); } public void removeEvent(MyDelegate ev) { myTimer.Tick -= new EventHandler(ev); } I don't know If Im doing anything ...