Application behaving strangely after displaying a sheet
Application behaving strangely after displaying a sheet
- Subject: Application behaving strangely after displaying a sheet
- From: Bruno Blondeau <email@hidden>
- Date: Sun, 04 Nov 2001 22:25:46 +0100
Please tell me there is something wrong in the following code:
// linked using setDoubleAction: on a NSTableView
- (IBAction) doubleClickOnHeader:(id)sender
{
...
[NSApp beginSheet:mySheet
modalForWindow:[myTextView window]
modalDelegate:self
didEndSelector:NULL
contextInfo:NULL];
modalVal = [NSApp runModalForWindow:mySheet];
[NSApp endSheet:mySheet];
[mySheet orderOut:NULL];
...
}
One of the buttons is for example:
- (IBAction)ctpCancelButton:(id)sender
{
[NSApp stopModalWithCode:0];
}
Of course, this action is working perfectly if called from a menu item, but
not from a "doubleAction" (double-click on the NSTableView)
So, what kind of strange behavior do I have?
Well, the sheet is displayed after a double-click on a table column (got no
answer explaining me how to display an edit field instead...).
Nothing is working properly after clicking for example on the cancel button
of the sheet.
- if I move another application in the foreground, and then try to click on
the dock icon to display the application, the window remain in the back,
only the menu bar appear. However, if I click in the menu bar, the window
magically appear again.
- if I do an horizontal click&drag on a menu, it initiates a table column
reordering (but with the mouse cursor still in the menu bar), and quickly
displays the menu content when the mouse button is released. The same
problem can be repeated by clicking somewhere else, such as a table row,
with the same consequence (but a little less spectacular, moving a column by
clicking on a table row is not as funny as clicking on a menu)
- clicking in the NSTextView doesn't make the editing cursor blink. If type
some text, it is not displayed until I click again in it. This is repeatable
several time (text only appearing after each click).
- The only way to make things work properly for sure is to click on the
window title. Hard to tell this to a customer...
Well I'm rather new to Cocoa, but it's not the first time I have to find a
workaround to a silly behavior, so I'm trying a few things such as:
[mywindow makeKeyAndOrderFront:NULL];
(this first one doesn't do anything, and especially doesn't solve the first
problem. I would have expected this to simulate a click on the window title)
[mywindow makeFirstResponder:myTextView];
(this one doesn't make the cursor blink to solve the 3rd problem).
--
Bruno Blondeau