events

How to register a non-static callback as a function pointer in a C++/CLI environment ?

We have a C++/CLI class, let us call it class A, from which we would like to register a non-static callback ("MyNonStaticCallback") into an unmanaged C++ class (class B). e.g. void MyNonStaticCallback(void* ...) { // Raise a C# event from this code } // Register callback into class B myClassBInstance->RegisterCallback(..., &MyNon...

jQuery .hover on future elements

Hi, I have a jsFiddle set up here that i want to work on future elements that will be injected into the DOM via AJAX etc: http://jsfiddle.net/Nb3uW/5/ How would i go about converting this over? ...

C# PropertyGrid DoubleClick event capture

For a project I am working on, I have some values in a PropertyGrid that are many lines long. I want the user to be able to double-click a value in the grid, which will bring up my custom UI window. I already have it set up so that the UI works when the [...] button is clicked, but I also need it to show up directly if any grid item is...

Making combos with keyboard and detecting the most precise

On the window I bind two keydown events. The condition for triggering a callback function is a certain sequence: Event #1: ["down", "right", "a"] Event #2: ["down", "right", "down", "right", "a"] How can I check if the user pressed the event 2 keys and then cancel the event 1? Here is the code, focus on the red div and press the keys...

Filtering out auto-generated methods (getter/setter/add/remove/.etc) returned by Type.GetMethods()

I use Type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) to retrieve an array of methods for a given type. The problem is the returned MethodInfo could include methods that are generated by the compiler which I don't want. For example: property bool Enabled { get; } will get bo...

C# Re-Root Reference to Object Using Events before GC Disposes, Ergo Auto-Depency Pattern and Memory/CPU-Efficient Collection

I thought this would be an interesting pattern. A collection of objects is stored in a manager class. When an object is not needed, it is removed from the collection. If it is needed again, and the GC hasn't disposed of it yet, poll for the instance of the existing object with a weak event. For example: class Manager { //--- Events ...

How do events cause memory leaks in C# and how do Weak References help mitigate that?

There are two ways (that I know of) to cause an unintentional memory leak in C#: Not disposing of resources that implement IDisposable Referencing and de-referencing events incorrectly. I don't really understand the second point. If the source object has a longer lifetime than the listener, and the listener doesn't need the events a...

Object Sender and EventArgs

Consider this function signature: Private Void TextBox1_TextChange(Object Sender, EventArgs e) As far as my knowledge goes I understand it as below. Private is a modifier Void is the return type TextBox1_TextChange is an event name. Maybe I am wrong in the above case as I just started practicing in C#, Visual Studio 2005. What is...

MySQL event scheduling update query

I am just getting to grips with the event scheduler in MySQL and I am writing a query to update a column on the same date each year. The problem I am having is working out the best way to structure my update query. Every user has a value in column_x that is a varchar field in the format of int/int. These values range from 7/1 to 7/11, ...

How do we PUSH new updates on iCal events?

How can we PUSH to the subscribed device new updates? I can easily generate a .ics file from my CRM Diary, and successfully importing to Google as a new Calendar URL, but when I create a new entry in my CRM Diary, how can I alert "Google Calendar" for the new created/updated event? I'm a little lost, and I can't find a solution, I ...

how to monitor the event of mouse or keyboard

Hi, there. On Linux, is there any way in which I could shutdown the system if none action is taken by the user in some time(e.g. 30 minutes)? Thanks in advance. ...

Delete / Kill / Remove UserControl and its events handlers

Hello, I dynamically create UserControls using Reflection: UserControl myConmtrol = (UserControl)Activator.CreateInstance(t); The UserControl may handle a Closing event but I do not know the name of the handler. When the Window hosting the UserControl closes I remove the UserControl from its parent Window and it disappears from the Wi...

jQuery unbind Live/Delegate events with namespace

Hi! I'm trying to unbind a live event (have tried with .live and with .delegate). When I want to unbind it I have 3 different options: unbind "click", unbind "click.namespace1" or unbind ".namespace1". They all do different things: first one unbind all click events (is not what I want), the second one unbind only the events at "click" ...

Handling PropertyChanged in a type-safe way

There have been plenty of articles about how to use reflection and LINQ to raise PropertyChanged events in a type-safe way, without using strings. But is there any way to consume PropertyChanged events in a type-safe manner? Currently, I'm doing this void model_PropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e....

how to use event bubbling cancellation

Hi All I've looked everywhere for a code on how to stop event bubbling to occur, and I've found one from the Quirksmode website, which is this: function doSomething(e){ if(!e) var e = window.event; e.cancelBubble = true; if(e.stopPropagation) e.stopPropagation(); } But I don't know how and where to use it. What is the 'e'...

Raise event when all asynchronous method calls are complete

Hi folks, i have the following issue: In asynchronous context i need to initialize fields of some custom object before i can proceed with other operations on it, so i do: class ContainingObject { private CustomObject _co; SomeMethod() { _co = new CustomObject(); _co.InitObjectAsyncCompleted += (s,e) => DoStuff()...

How can I capture the MouseLeftButtonDown event for any child in the form even the children captured this event?

How can I capture the MouseLeftButtonDown event for any child in the form even the children captured this event? ...

How to copy html with events jQuery

Could you please tell me how to copy events, if I copy some html? I have a function to copy: function add_to_order( row, row_input_value ) { $('#buffer').html( row ).find('td:first').remove(); // add row to buffer and remove the first td element $('#buffer').append('<td class="delete"><span class="remove-from-order button minus...

WPF: Putting focus back on textbox recursively calling Lost focus event.How to solve ?

I have a WPF form where a text box and label is present.In the "Lost Focus" event of text box, i am doing some validation and if the validation fails i will show an error message in the label and put focus back on the textbox. The problem is since i put the focus back on the text bos,the "Lost_Focus event s again fired and my validation ...

Custom Event on Custom Control

I've got a custom control we'll call "TheGrid". In TheGrid's controls is another control we'll call "GridMenu". GridMenu has a button control in its own control collection. I'd like to enable the developer using this control to associate a page level method with the OnClick of that button deep down inside GridMenu ala: <customcontrol...