discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notifications in modal loops


From: Fred Kiefer
Subject: Re: Notifications in modal loops
Date: Thu, 08 Feb 2007 18:39:05 +0100
User-agent: Thunderbird 1.5.0.9 (X11/20060911)

Andreas Höschler schrieb:
> Hi all,
> 
> I have a custom panel with some textfields that I would like to run modal.
> 
> - (NSPrintInfo *)runForFile:(NSString *)path numberOfPages:(int)pages
> {
>   // Setting up the ui elements
>    [fromField setDelegate:self];
>    [toField setDelegate:self];
>    if ([NSApp runModalForWindow:mainWin] == NSRunStoppedResponse)
>      {
>     // do something useful
>      }
>    else return nil;
> }
> 
> - (void)textDidChange:(NSNotification *)aNotification
> {
>    NSLog(@"textDidChange...");
>    // do something useful
> }
> 
> The problem is that the delegate method textDidChange: is not called
> while the panel is displayed (when entering text in the text fields).
> Any idea why? I suppose that has to do with the modal loop and would
> most likely work if I did not use runModalForWindow: but [mainWin
> orderFront:]. But I want this dialog to be modal.
> 

I think this has nothing to do with modality of the window. You are just
waiting for the wrong method to be called. If fromField and toField are
both NSTextField objects, then the delegate method should be called
conrolTextDidChange:
It should be the same on MacOSX.

Cheers,
Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]