I have a class which wraps another class and exposes several events from the class it's wrapping. (The instance it wraps can change)
I used the following code:
public event EventHandler AnEvent;
public OtherClass Inner {
get { /* ... */ }
set {
//...
if(value != null)
value.AnEvent += AnEvent;
...
Basically I have this function:
private function clickURL(url:String):Function{
trace("Function has been instantiated");
return function(event:MouseEvent):void{
trace("Function has been run");
ExternalNavigation.newBrowserWindow(url);
}
}
The purpose of this function is to take an url, put the url in another fun...
I'm working in Visual Studio 2008 and I would like for Edit > Outlining > Collapse to Definitions to be run whenever I open a file. It would be nice if, after that, all regions were expanded. I tried the code that Kyralessa offered in a comment on The Problem with Code Folding, and that works very nicely as a macro that I have to run m...
Is it possible for me to use ChangeHappend in my derived class. If so how?
If not, what should I do instead?
class Base
{
public delegate void ChangeHandler(object sender);
public event ChangeHandler ChangeHappend;
private int _foo;
public int Foo
{
set
{
if (_foo == value) return;
...
I have some code which involves dynamically creating new buttons, when a user clicks on a particular button. However the EventHandlers defined for these dynamically created buttons do not execute when I click on any one of them. Here is the errant code snippet:
protected void Page_Load(object sender, EventArgs e)
{
.......
btn1....
If I have an application with only a few event handlers registered (and the objects using the events are not disposed until the application is closed), do I really need to worry about unregistering those handlers? The only good reason I could see is that there might be a little extra overhead if events are being fired that you dont nece...
When I have an object, removing all references to it is enough to sign it up for the garbage collector, atleast that's what I heard. Eg.:
removeChild(object);
object = null;
I'm still a bit confused though, because does this mean that the event listeners made inside this object's instance are also automatically removed? Or is there an...
Hello, I have a UIView where I use the touchesbegan event, but I realized that once I put my finger on it, the touchesBegan event takes like 1 or 2 seconds to fire. How can I make this happen faster?
thanks!!!
...
I'm using a class that forwards events in C#. I was wondering if there's a way of doing
it that requires less code overhead.
Here's an example of what I have so far.
class A
{
public event EventType EventA;
}
class B
{
A m_A = new A();
public event EventType EventB;
public B()
{
m_A.EventA += OnEventA;
}
p...
I have the following bit of code in a method called by clicking the send button, or pressing enter in the message text field in a piece of code.
// In class ChatWindow
private void messageTextAreaKeyPressed(java.awt.event.KeyEvent evt) { // Event handler created by Netbeans GUI designer to call this method.
if(evt.getKeyC...
I have a MDI form that will open a logon form so the user can be authenticated
when the user hits the logon button and is properly authenticated i wanted to trigger an event that the parent form could pick up and change some variables ((authenticated = true) for example)
I understand how to do this in something like a textbox or a cost...
Hi,
I have an event handler in code that I see is getting called multiple times when I am expecting it to only be called once.
In the past this has been because I have defined the delegation in the wrong place (so more that one delegate is added to the event handling list), but on this occastion this is only being set once (in the clas...
Design Question – Polymorphic Event Handling
I’m currently trying to reduce the number of Event Handles in my current project. We have multiple systems that send data over USB. I currently have a routine to read in the messages and parse the initial header details to determine which system the message came from. The headers are a lit...
I have a view controller with a UIWebView controller. I'm trying to get the javascript inside the html content of the web view to pass some information to my objective c code. I came across a number of examples online that set window.location in a javascript function and then catch the event generated by setting the view controller to be...
Context:
There's an application where you draw things on canvas. Where user clicks there's a black dot, for example. But handling that events raised by canvas in event handlers in main window code is just ugly for me. So I wrote a class which methods mirror canvas mouse events and I call those methods inside event handler.
public part...
Below I am creating an object in Javascript. Within the constructor I am setting up an event listener. The problem is that when the event gets fired, this.prop cannot be found, and undefined prints out. How do I solve this?
var someObj = function someObj(){
this.prop = 33;
this.mouseMoving = function() { console.log(this...
I have a Word userform with 60+ controls of varying types. I would like to evaluate the form every time a control_change event is triggered and change the enabled state of the form's submit button. However, I really don't want to write and maintain 60 on change event handlers.
Could anyone help me out?
Cheers
...
Sometimes I want to attach an event handler but I'm not sure if I've done it already to that object. My workaround is to remove it using -= then add it using += . Is there a better way?
Edit: The reason I want to make sure not to do it twice (or more) is that if I do, it will get fired twice (or more)
...
What event system for Python do you use? I'm already aware of pydispatcher, but I was wondering what else can be found, or is commonly used?
I'm not interested in event managers that are part of large frameworks, I'd rather use a small bare-bones solution that I can easily extend.
...