delegates

iPad issue with a modal view: modal view label null after view controller is created

This is a weird issue. I have created a view controller with a nib file for my modal view. On that view there is a label, number and text view. When I create the view from the source view, I tried to set the label, but it shows that the label is null (0x0). Kinda weird... Any suggestions? Now lets look at the code (I put all of the ...

How to invoke a delegate with a null parameter?

I get a null exception if I try to pass a null parameter to a delegate during an invoke. Here's what the code looks like: public void RequestPhoto() { WCF.Service.BeginGetUserPhoto(Contact.UserID, new AsyncCallback(RequestPhotoCB), null); } public void RequestPhotoCB(IAsyncR...

Checking if an object has been released before sending a message to it

I've only recently noticed a crash in one of my apps when an object tried to message its delegate and the delegate had already been released. At the moment, just before calling any delegate methods, I run this check: if (delegate && [delegate respondsToSelector:...]){ [delegate ...]; } But obviously this doesn't account for if the...

Can i access outer class objects in inner class

I have three classes like this. class A { public class innerB { //Do something } public class innerC { //trying to access objB here directly or indirectly over here. //I dont have to create an object of innerB, but to access the object created by A //i.e. innerB ...

C# delegate compiler optimisation

I have started to use anonymous delegates a lot in C# and I have begun to wonder how efficient the complier or runtime is in removing them from the code that is actually run and I haven't seen this detailed anywhere? Is it clever enough at all to inline them and collapse recursive uses that could be statically deduced? ...

How to make item view render rich (html) text in PyQt?

I'm trying to translate code from this thread in python: import sys from PyQt4.QtCore import * from PyQt4.QtGui import * __data__ = [ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", "Ut enim ad minim veniam, quis nostrud exercitation ull...

what exactly is delegate in C#

Possible Duplicate: Can someone distill into proper English what a delegate is? Hi All, can somebody explain the use of delegate..I know that it is used to invoke methods at run time...but exactly what does it mean..can somebody explain it with some simple example, which will help a newcomer to understand delegate better ...

Make a c# / wpf event fire only once?

I have a case where I want a given event to execute once, and only once. I'm trying to do it this way, but I'm having prolems (else I wouldn't be asking). Note that the following code is inside the function that decides that the event needs to be fired. EventHandler h = delegate(Object sender, EventArgs e) { FiringControl.TheEvent...

Pass an event into a constructor

I have a class that I want to be able the handle the mouse up event for a grid. I tried to create it with a static method call like this: MyDataBinding.BindObjectsToDataGrid(ListOfObjectsToBind, myGrid.MouseUp); The end goal being that in the method I would assign a delegate to the MouseUp PassedInMouseUp += myMethodThatWillHandleTh...

c++/cli pass (managed) delegate to unmanaged code

How do I pass a function pointer from managed C++ (C++/CLI) to an unmanaged method? I read a few articles, like this one from MSDN, but it describes two different assemblies, while I want only one. Here is my code: 1) Header (MyInterop.ManagedCppLib.h): #pragma once using namespace System; namespace MyInterop { namespace ManagedCppL...

UIWebView loaded from another class, where to put delegate methods?

Hey. I'm loading in a UIWebView from another class, and that works great. But now I need to know how I can implement these delegate methods: - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType // AND: - (void)alertView:(UIAlertView *)alertView c...

what is Delegate in iPhone?

what is the exact meaning of delegate in iphone?how it is implemented in UIViewController? ...

How to subscribe to EventHandler of a private control outside of Form

Hi all, maybe my design is not good, or I don't see the obvious solution, but I want to subscribe to a buttonClick EventHandler of Form1 from outside form1. For example I have a Controller and Form1 who are both instanced in the main function. Now I want to subscribe a function from Controller to the buttonClick event from Button1_Cl...

OO model for nsxmlparser when delegate is not self

Hi, I am struggling with the correct design for the delegates of nsxmlparser. In order to build my table of Foos, I need to make two types of webservice calls; one for the whole table and one for each row. It's essentially a master-query then detail-query, except the master-query-result-xml doesn't return enough information so i then n...

how to tell which object called a delegate method (objective c)

Let's say you have two objects (for example, a UITextviews, but it could be any type) in your class. When the text view changes, you have a delegate method that catches the change.. but how can you tell programatically WHICH object was changed and called the delegate ?? (Possible thought) Basically how to you get the variable name of a...

objective c - delegate and events

Hello all, I am looking for good example code for using delegate and events in objective c? i am familiar with delegate and events in C#. so if someone can help me with few lines of code it will be very helpful. ...

C# Func delegate with params type

How, in C#, do I have a Func parameter representing a method with this signature? XmlNode createSection(XmlDocument doc, params XmlNode[] childNodes) I tried having a parameter of type Func<XmlDocument, params XmlNode[], XmlNode> but, ooh, ReSharper/Visual Studio 2008 go crazy highlighting that in red. Update: okay, Googling for 'c#...

What happens if an asynchronous delegate call never returns?

I found a decent looking example of how to call a delegate asynchronously with a timeout... http://www.eggheadcafe.com/tutorials/aspnet/847c94bf-4b8d-4a66-9ae5-5b61f049019f/basics-make-any-method-c.aspx. In summary it uses WaitOne with a timeout to determine if the call does not return before the timeout expires. I also know that you s...

C# event and delegate

I want to detach the custom event but could not detach. Below I am using -= to detach the event. I assume after this, the TextChanged2 method should not be invoked as I have unregistered the event. Is my understanding wrong? public delegate void TextChangedEventHandler1(object sender, TextBoxargs ta); public event TextChangedEventHandle...

Delegates with explicit "this" pointer?

Is it possible to adapt a method like this function "F" class C { public void F(int i); } to a delegate like Action<C,int>? I have this vague recollection that Microsoft was working on supporting this kind of adaptation. But maybe I misremembered! Edit: I know that this doesn't compile in VS2008: class C { public void F(int...