delegates

Delegate, BeginInvoke. EndInvoke - How to clean up multiple Async threat calls to the same delegate?

I've created a Delegate that I intend to call Async. Module Level Delegate Sub GetPartListDataFromServer(ByVal dvOriginal As DataView, ByVal ProgramID As Integer) Dim dlgGetPartList As GetPartListDataFromServer The following code I use in a method Dim dlgGetPartList As New GetPartListDataFromServer(AddressOf AsyncThreadMethod_G...

Passing param to delegate method running on new thread .. Am I crossing UI/Thread bounds?

I have a delegate for a method. I start it in a new thread that has a parameter in it in which I pass a DataView into. The new thread is obviously not running on the UI thread so I should not be accessing any UI controls. The dataview I am passing into the delegated method however I got the reference from ComboBox.DataSource where Com...

What's the difference between data source and delegate ?

I have a fundamental question related to Cocoa frameworks design patterns. What's the difference between delegate and data source? Both of them could use @protocols declaration, but some classes or frameworks are using delegate, and some others are using data source. All I can understand from UI/NSTableView is the delegate respond to ...

Delegates Vs. Notifications in iPhoneOS

I am trying to call a method in my root view controller from a child view controller such that when I change my options they will automatically update the root view, which will in turn update several other view controllers. For the second part I have used notifications, but for this first I am trying to use a delegate because it (so I h...

When using AsynchCallback, where do you register the code to call when AsynchCallback has completed ?

Hi, I am following sample code on implementing MVVM in Silverlight (see: http://msdn.microsoft.com/en-us/magazine/dd458800.aspx). On page 5 (when printed), the author has the following segment of code: qry.BeginExecute(new AsyncCallback => a { try { IEnumerable<Game> results = qry.EndExecute(a); if (GameLoadin...

How to verify if a delegate responds to a selector?

Hello, I know I need to write: [delegate respondsToSelector:@selector(myMethod:)] But the compiler is complaining that respondsToSelector is not a method in the protocol, which is correct, However I have seen many sample code use this, how do you do it?. Thank you. -Oscar ...

Am I not understanding Obj-C at all? Why won't this NSLog message display?

main.m #import <Cocoa/Cocoa.h> int main(int argc, char *argv[]) { return NSApplicationMain(argc, (const char **) argv); } CoolClass.h #import <Cocoa/Cocoa.h> @interface CoolClass : NSObject <NSApplicationDelegate> { } - (void) applicationDidFinishLaunching : (NSNotification *) aNotification; @end CoolClass.m #import "CoolC...

Ascess the instance variable globally in objective c

I am new to iphone development.I want to access a variable declared in one view in another view.How can i achieve it.Whether it is possible by using extern variable, if so how to declare and implement it.Can i achieve it by using delegates?then so how to implement it.Please guide me.I am browsing google to get and idea to achieve it, i ...

Already defined delegate

I heard once that .net introduced an already defined delegate with no parameter that we could use instead of creating one. I'm having a hard time finding it and for what version of .net. (if it really exists) Thanks! ...

Can Invoke execute main UI thread code that throws exception?

In my code below, I am using Process objects to execute a series of DOS batch files. I'm shortening the list of scripts for example's sake. The subsequent (1+) scripts execute via an event handler (instead of a for loop). That way, each subsequent script runs ONLY when the previous one finishes. Now for some reason as I execute the 2nd ...

Should I nil delegate references made through Interface Builder?

If I assign a delegate property from classB to classA from Interface Builder, should I assign an IBOutlet to classB, then in classA dealloc, set the delegate to nil via the outlet? (Assuming classA is the file's owner of the XIB...) ...

How do you provide xml comments/documentation for delegate parameters?

given a delegate like Func<string,string,string> MyFunc = (firstName,lastName) => string.Format("Given Name:{0} Surname:{1}", firstName, lastName); How would you can you document the ...

Do I need an '@class' declaration in my AppDelegate.h file for every view controller in my project?

Please explain your answers as I've gotten away with not having to do this so far. Thanks ...

How many UINavigationController objects in a single iPhone application?

I think one of my design problems is that I keep creating navigation objects when I should only have one UINavigationController and a delegate. Is that correct? I not as concerned from a style-preference, but the answer I am looking for is more about the a technical perspective and managing the navigation among several view controllers...

Possible to call another event with an event?

I have a database with LINQ to SQL ORM. I am manipulating the database with the repository pattern. My IAssignmentRepository implements INotifyCollectionChanged with its single event, CollectionChanged. I just want to know if it was possible (and senseless) for me to create a delegate (AssignmentsChangedDelegate) and event (AssignmentsCh...

Scope of a delegate in C#

Hi folks, can delegates be private, if not what's the reason behind this other than the normal restrictions caused by it being private. TIA ...

System.ArgumentException was unhandled when using -= on a event delegate?

I have this code: public void setPanelHalfHorizontalScreen(Panel p) { if (p != null) { p.Width = Screen.PrimaryScreen.Bounds.Width / 2 - 2; this.panelsForHalfScreen.Add(p.Name, p); // http://stackoverflow.com/questions/2261828/does-an-event-gets-executed-tw...

Should I put my UITabBarController outside the App Delegate?

Hi guys, I followed an example from "Beginning iPhone 3 Development" which puts the code for the main view controller, a Tab Bar, in the delegate method. Is this the correct place to put this or should it be in a separate .h and .m file? All my subviews are in separate files so I'm wondering if I should have my tab bar view controller ...

Can I pass a delegate into a constructor of an abstract class from a descendant's constructor?

I have an abstract class which requires a delegate to function. I pass the delegate into the constructor. Now that I have a non default constructor I need to call the abstract class's constructors from the concrete class which means that I need to use MyBase.New(...). I have included a quick example below. Public MustInherit Class BaseC...

What are some common scenarios where delegates should be used?

I understand how delegates and events work. I can also imagine some common scenarios where we should implement events, but I’m having harder times understanding in what situations should delegates be used. thanx REPLYING TO USER KVB'S POST: a) You can basically use delegates wherever you would otherwise use a one-method interfa...