delegates

How do I use Linq ToDictionary to return a dictionary with multiple values in the dictionary items?

I want to group items from a linq query under a header, so that for each header I have a list of objects that match the header title. I assumed the solution would be to use ToDictionary to convert the objects, but this allows only one object per "group" (or dictionary key). I assumed I could create the dictionary of type (String, List Of...

Understand the alternatives for calling methods asynchronously in .NET

What's the difference between calling .NET methods asynchronously by using: BeginInvoke/EndInvoke vs. IAsynchResult vs. Specific object asynchronous methods (WebClient, for example) I assume the difference between the first two and the third one is that some objects (WebClient in this case) natively support asynchronous calli...

How to render a a complex widget inside a tree view item in QT?

Hey! I have the following problem with QT model/view framework. I want to render a widget inside a table view item. First my thought was to use void QAbstractItemView::setIndexWidget( const QModelIndex & index, QWidget * widget ) But the documentation for this function explicitly states: This function should only be used to di...

Obtaining view controllers of tabbar control

I have a tabbar navigation controller, and I would like to set up a protocol in one view controller and set its delegate in another view controller. How would I get the view controller pointer of the delegating view controller to the delegate view controller? ...

Why isn't my custom iPhone delegate working?

Hi all, I'm just trying to build a simple delegate, it compiles successfully but it doesn't seem to do anything right now. Please review my code below, both FirstViewContoller and SecondViewController have separate xib files, the SecondViewController has a button hooked up to the myMethod of course. I've been learning my way around obj...

check if object has method with signature of delegate

How can I check if a object has a method with the same signature of a specific delegate public delegate T GetSomething<T>(int aParameter); public static void Method<T>(object o, GetSomething<T> gs) { //check if 'o' has a method with the signature of 'gs' } ...

GetInvocationList of an event in VB.NET

Hello, I am trying to learn some WCF principles by following an example of a WCF application (from Sacha Barber). Now I would like to convert the following function into VB.NET private void BroadcastMessage(ChatEventArgs e) { ChatEventHandler temp = ChatEvent; if (temp != null) { foreach (ChatEventHandler handl...

NSTimer with delegate method

I'm trying to set up an NSTimer on a delegate - I'm so very new to objective-c so apologies if this doesn't make much sense. But what I have written is: animationTimer = [NSTimer scheduledTimerWithTimeInterval:(NSTimeInterval)((1.0 / 60.0) * animationFrameInterval) target:self.delegate selector:@selector(drawView) userInfo:nil repeats:T...

[iPhone] ASIHTTPRequest, EXC_BAD_ACCESS when request did finished

Hi, I'm trying to do an asynchronous request with ASIHTTPRequest, but have some problem getting notified when the request is done. -(void)doDownload{ NSURL *url = [NSURL URLWithString:@"http://www.someurl.com/?"]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:@"someValue" forKe...

Synthetic Webserver with Cocoa WebView on Mac OS X

I would like to create a Webview where I have total control over the content it loads. Essentially I want to provide an instance of a class that plays the role of the various web servers named in the URLs. Ideally, I would provide this webview with a delegate and it would tell the delegate each URL it requires and the delegate would re...

What is the difference between setting the delegate in Interface Builder vs using setDelegate:?

I'm trying to set the delegate for a scroll view using Interface Builder. If I have code like this: MyScrollViewDelegate * delegate = [[MyScrollViewDelegate alloc] init]; [scrollView setDelegate:delegate]; in viewDidLoad, everything works perfectly. If I open Interface Builder, add an NSObject and set the class to MyScrollViewDelega...

UIWebView/MPMoviePlayerController and the "Done" button

I am using the UIWebView to load both streaming audio and video. I have properly set up the UIWebView delegate and I am receiving webViewDidStartLoading and webViewFinishedLoading events perfectly. The webview launches a full screen window (likely a MPMoviePlayerController) Apple's MoviePlayer example gets the array of Windows to deter...

Delegate problem with NSTextField

Hi... I am just starting with OSX development, and I am trying to get delegate notifications from a NSTextField. I've got the following code so far: This is where I set the delegate: - (void) awakeFromNib { NSLog(@"Setting delegate"); [amountField setDelegate: [[TextfieldController alloc] initWithLog]]; } And this is my Text...

XMLParser delegate and memory leaks

Hi everyone I am building an application that has to handle the parsing of several different kinds of XML files. As I want to standardize the procedure as much as possible, I created a singleton class which handles the parsing of any XML data. The class is handed two options, a unique identifier telling it what kind of XML data it is go...

Can two view controllers be delegates for one another?

Hi all, I'm learning objective-c and cocoa touch at the same time as building an app so I've got a fairly simple question (I think), sorry I don't have enough brownie points on the site to show a visual diagram of my site. But let me explain, I have the following Main ViewController ViewController A ViewController B ViewController C...

Delegate method seems to be @required where it's declared as @optional

I've created my own Delegate for a ObjC class. The class itself deals with Core Data operations. Delegate methods are used to inform other classes about changes that happened to the datastore. The class that deals with the datastore is called Datastore and it's delegate is called DatastoreDelegate. A UIViewController of mine (ContactsVie...

Set a timeout and get a result from a delegate thread

I've never had much to do with async callbacks and delegates before on WinForms (i.e., not AJAX) so I'm hoping someone can help me out with what I'm trying to do here. I'm logging into a third-party service over the web. The Login() method is of type Void. Because this can take up to 10 seconds (very occasionally longer) I want to do t...

how can I make asynchronous callbacks be processed in a different threadpool?

When doing a begin... async call, the delegate I pass is handled (according to the documentation) in the default threadpool. for instance: System.IO.Stream.BeginRead( byte[] buffer, int offset, int count, AsyncCallback callback, object state); How can I make it so that I can use a dedicated threadpool for async method handling? ...

How do I pass an event handler as a method parameter?

How can I pass the event handler TextBlock_MouseDown_Test1 or TextBlock_MouseDown_Test2 to SmartGrid so that the TextBlocks which it creates will execute this event handler when they are clicked? The code below gets the error: The best overloaded method match for 'TestDel234.SmartGrid.SmartGrid(TestDel234.Window1, System.Collec...

Abort a Thread started with Delegate.BeginInvoke

Disclaimer: I know that Thread.Abort is evil. I'm using it as a last resort since some I/O functions (e.g., File.Exists when used on a non-existing network share) block for a large amout of time and do not allow you to specify a timeout. Question: Is it possible to Abort (as in Thread.Abort) a worker thread started using Delegate.BeginI...