NSTableView tableViewSelectionDidChange: too late

  • Hi all,

    I've got an application with two windows. One is an NSPanel and holds an
    NSTableView. When a row in the table is clicked the data is shown in the
    main window (NSWindow). Before showing the data,
    selectionShouldChangeInTableView: is used by the controller (which is the
    tables delegate) to check whether something needs to be saved.

    If nothing has changed the data is shown correctly. However, if a save is
    needed, I display an alert panel (via NSRunAlertPanel). If that happens,
    the data in the main window is only updated if I either re-click the table
    row or I click on the main window. NSLog shows that in that case
    selectionShouldChangeInTableView: is called right away but
    tableViewSelectionDidChange is only send after the main window has been
    selected.

    The only difference that I can see is the requester but why should it
    interfere with the normal order of events?

    Any help appreciated,

    with best regards,

    chris
  • Hello,

    as I just found out, when I insert the following line into the example
    programme "Score Table" from chapter 18 of Cocoa Programming the same
    happens:

    - (BOOL)selectionShouldChangeInTableView:(NSTableView *)tv{
        NSRunAlertPanel(@"Click me",@"Click me please!",@"OK",@"",@"");
        return YES;
    }

    That is, the table row is selected but the details view is only updated
    after a click on the window.

    Regards,

    chris

    --Christian Schneider (<macosx-dev...>) wrote on Donnerstag, 2.
    Oktober 2003 16:15 Uhr +0200:

    > Hi all,
    >
    > I've got an application with two windows. One is an NSPanel and holds an
    > NSTableView. When a row in the table is clicked the data is shown in the
    > main window (NSWindow). Before showing the data,
    > selectionShouldChangeInTableView: is used by the controller (which is the
    > tables delegate) to check whether something needs to be saved.
    >
    > If nothing has changed the data is shown correctly. However, if a save is
    > needed, I display an alert panel (via NSRunAlertPanel). If that happens,
    > the data in the main window is only updated if I either re-click the
    > table row or I click on the main window. NSLog shows that in that case
    > selectionShouldChangeInTableView: is called right away but
    > tableViewSelectionDidChange is only send after the main window has been
    > selected.
    >
    > The only difference that I can see is the requester but why should it
    > interfere with the normal order of events?
    >
    > Any help appreciated,
    >
    > with best regards,
    >
    > chris

    --
    Christian Schneider
    <cschneid...>
previous month october 2003 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today