Raphael - How create a custom event - events

As I wrote I'd like to write a custom event foa a Raphael's element, how can i do?
I just saw that eve(name, scope, varargs) but I didn't understand well, and if properly for creating a custom event.
I'd like understand how to create a my own custom event.

Related

Devexpress detail gridview events not firing

I have a master "gridview" and a detail "gridview" connected to it. The detail "gridview" does not have any columns initially, it loads data from database and it creates its columns.
For example, i'm trying to handle cellvaluechanged event, however, even if i write something in a cell of the gridview and then pressing enter, the event is not firing. What can the reason be?
In my opinion the best way to handle this is: Create a class which represent the data from your database. Let the class implement the interface INotifyPropertyChanged. Then create a BindingList with all Objects from your Database. Now use this BindingList as DataSource for your Grid. The BindingList got the Event ListChanged. This will recognize that a Property Value in your DataSource is changed if you type some new value in cell.
I think this is best practice because you are working with your DataSource and not with GridView directly.
Otherwise the event should fire for sure. If you cant use my idea send some code, maybe i can find the problem then.
regards

jQuery: How to add and handle the beforeChange event to input element?

I have read all the official documentation of jQuery 1.7.2, but I cannot find any detail about the 'beforechange' event (or something like that) which help me control some rules before allowing the element to change its value. Is there any plugins provide this handler?
Thank you so much!
The jQuery api doesnot provide the 'beforechange' event but instead provide great flexibility to write our own custom events. We can define our own custom events and can be triggered when the events is fired.
For example for input elements we can have onkeydown or onkeypress events and when fired we can trigger our custom events to control some rules.
The following link provides information for creating custom events. Its very simple and flexible.
http://scriptble.com/2009/05/custom-events-with-jquery

When using data binding, how do I know when a control was added?

When using data binding, how do I know when a control was added?
I'm using ItemsControl element with ItemTemplate.
I want to know when a control was added like event(ex. OnControlAdded)
Please help me
That's not how it's supposed to work, you got it upside down.
You're supposed to have a ViewModel, and Collection in there that you then bind to your ItemsControl.
On that collection, which should be observable, you have a CollectionChanged event. Subscribe to this one, it will fire when elements are added/removed which in turn will make your ItemsControl grow/shrink.

using jquery, if i need to capture dropdown change event, do i need livequery plugin?

I want to have some code run when i change the selection of a dropdown. i see the livequery plugin states that this is needed to support as some browsers don't do it out of the box
Do I really need livequery to capture onchange event of a dropdown that i create dynamically or does the regular live syntax work in all browsers?
live takes advantage of event bubling mechanism so we can attach event handlers to elements which are created dynamically also, it will work as expected since it attaches event to the document element and listens to them. But I believe change event is not bubbled upto the dom tree so it may not work.
from this page, it looks like you need livequery for it to work in IE
No. You should be able to use just the standard jquery api.
for the dynamic elemenets use .live('change', function to capture the event.

pass button click event through several usercontrols to a form and let another usercontrol know the button clicked

I know it sounds complex but thats true.
I have a winform(clientFile) which in a project. It uses an usercontrol in another project. This usercontorl is FinancialManager.It is initialized in constructor.
In FinancialManager, there is another child usercontrol(FinancialService) which is initialized in constructor too.
In FinancialService, it has a button and in the button click event, it initialized the last usercontrol(FinancialItem).
I need to use WINFORM and C# to let my usercontrol(timeControl) which is in the ClientFile(initialized in page_load) know the button in FinancialItem is clicked.
is there any good way to do it? If you can give a sample code, that will be perfect.
Thank you.
by the way, those usercontrols are in one project. except my usercontrol(timeControl).
Since you can control the code in your own usercontrols, it seems to me like you want to add a custom event in one of your usercontrols. Then diferent code can subscribe to this event and will know if the event was triggered.
...but it was a bit hard to understand exactly what you wanted...
Look up a basic event tutorial, and you're probably good to go.

Resources