All examples on System.Reactive.dll I've seen so far deal with Events, EventArgs and EventHandlers, I wonder whether someone can show me an example where event notification is handled without this.
For instance, in Microsoft's XNA framework, you have a static method called Mouse.GetState() which will return the current MouseState (with ...
Should an addListener method check for duplicate registrations when called? If so, what should happen when a duplicate is found?
final public class exampleCanFire {
public void addFooListener(FooListener listener) {
// Before adding listener to private list of listeners, should I check for duplicates?
}
}
...
Hi community,
I have a question about event handling with C#. I listen to events a class A throws. Now when the event ist thrown a method is executed that does something. This method sometimes has to wait for respones from datasources or similar.
I think event handling is synchronous so one after another event will be processed. Is it ...
private void NuestroButton1_Click(object sender, RoutedEventArgs e)
{
if //the sender's .Text/.Content is X
{
//Do something
System.Windows.Browser.HtmlPage.Window.Alert("Hello World");
}
}
How can I use something like sender.Text to see what the .Text is of the clicked button?
...
Hi,
I have an app with a canvas which content changes dynamically. In my app there is a progressbar which I want to show while the canvas update is executed. Is there any event to call just before the update starts?
Thanks!
...
I've always assigned event handlers like this, guided by Intellisense auto-completion.
RangeSelector.RangeChanged += new EventHandler(RangeSelector_RangeChanged);
I've recently noticed one of my colleagues does it this way.
RangeSelector.RangeChanged += RangeSelector_RangeChanged;
Both methods are syntactically correct, compile and...
I would like to know if is there some jquery known behaviour that cause the lost of events handlers (in particular in iframes)?
I've a strange kind of problem.
I've built a webapp composed of two iframe.
First i load content in the first iframe. I add some event event handler using jquery to first iframe content dom.
Everything works....
Im using event handlers from a framework (prototype to be specific) to attach listerners to certain elements of a page like this:
//html
<a href="?default=1" class="default">Set Default</a>
//js
document.observe('dom:loaded', function(){
//get all elements with d 'default' classname
for(i = 0;i < document.getElementsByCl...
See Also:
understanding events and event handlers in C#
As a web dev, I don't typically have to get into building my own events for objects, since most are inherent in the page. However, now I'm into a pretty complex (web) project where I think I may have to use them. I just read a chapter out of Pro VB 2008 and the .NET 3.5 Pl...
Hi,
What is the best way to display, in a web part, dynamic tables where each cell can cause a postback to display a different set of data?
For example, imagine some financial data:
Table 1: Quarters in year
| Q1 | Q2 | Q3 | Q4 |
Things 1 | 23 | 34 | 44 | 32 |
Things 2 | 24 | 76 | 67 | 98 |
On...
Hi,
Is it possible to set, on a control (a linkbutton for example) an eventhandler which is not in the same context as the control creation?
For example, I have an instance of Class1 which instances Class2, the control is created in Class2, but I need the eventhandler to be in Class1.
Pseudo Code:
public class Class1
{
public Cla...
Maybe I'm slow, but I just don't get why you would ever use an event that is not derived from an actual action (like clicking). Why go through the rigamarole of creating delegates and events when you can just call a method? It seems like when you create an event, all you're doing is creating a way for the caller to go through some compli...
In a nutshell what my program does is: it executes and takes user input periodically using nswindow (which is controlled by my NSWindowController object) and continues execution.
here is my myController.mm which is calling and showing the window to take user input:
EncryptPasswordDlgController encPassController = [[EncryptPasswordDlgC...
How to fire up event from a separate C# program?
The C# program I am working on has two separate components: Task Creator (TC) and Task Processor (TP). TC is attached to a web service that constantly inserts new tasks into a database table. On the other hand TP reads from the same table and processes each tasks then updates the status b...
I'm trying to convert the below bit of code into VB (and obviously apply it to my own solution) that I took from this MSDN article
// The event. Note that by using the generic EventHandler<T> event type
// we do not need to declare a separate delegate type.
public event EventHandler<ShapeEventArgs> ShapeChanged;
//The event-invoking me...
IN VB.NET (not c#)...
I want to create an event than can be canceled by the listener. Just like you can cancel the closing event of a winforms form in which case the form won't close.
I have already implemented a derived class from EventArgs that has a settable Cancel property as follows:
Public Class AnnounceNavigateEventArgs
In...
I have 2 types of objects, Parents, and Children. I have an abstract class for these two objects. There are 2 types of parents, ParentA, ParentB and there are 2 types of children, ChildA, ChildB. These all inherited their corresponding base classes, i.e ParentA:Parent, ParentB:Parent, ChildA:Child, ChildB:Child.
Each parent has a collec...
Event of dynamically added control is not fired. This happens in a function called in the create child controls event of the page.
Button bb = new Button();
bb.Click += new EventHandler(bb_Click);
PlaceHolderQuestions.Controls.Add(bb);
...
When I want to prevent other event handlers from executing after certain event is fired I can do one of those (jQuery examples, but this will work in JS in general):
#1 event.preventDefault()
$('a').click(function (e) {
// custom handling here
e.preventDefault();
});
#2 return false
$('a').click(function () {
// custom ...
In trying to convert some of my JS to cross-browser compatibility, I've come across strange behaviour where I'm unable pinpoint the problem.
I want to convert window.event.x (IE specific) using jQuery, so my code looks as follows:
function someFunction(e){
var ev = $.event.fix(e);
alert(ev.pageX);
}
This returns the correct val...