showOver_ don't stay on screen

I have gCreateWindow (a “sheet”) and gWindow (main window) declared as properties and loaded from nib.

I call:
gWindow’s makeKeyAndOrderFront_(me)
tell gCreateWindow to showOver_(gWindow)

and then my main window appears, with the sheet over it, during a tenth of a second, and then everything disappears, and when I open a new doc and make my main window reappear, the toolbar buttons stay disabled.

What’s wrong with them? normally the sheet stays on screen until one of its buttons is clicked, trigging a method who says:
tell current application’s NSApp to endSheet_(gCreateWindow)
but when the sheet flashes in the screen, this method is NOT called…

Any idea? – everything is resisting today. It’s like a loooong monday…:frowning:

it sounds like a problem somewhere else in your code.

Yes, I think I should try collecting stamps instead of programming…:confused: My problem is, I wanted to buy a candle and I’ve entered a nuclear plant… or maybe I’m just getting too old :frowning:

Thanks anyway!

What does “showOver_” do? There are ways to call sheets that you might want to look into, or use a more standard implementation.

Saves you a lot of typing. See Myriad Helpers at http://www.macosxautomation.com/applescript/apps/helpers.html.

Hello Shane, thanks for the post.

I’ve moved into an old trap, focusing on cosmetics instead of attacking the real problems. For the moment I returned to a more standard way to choose folder, for three reasons:
a) The main window appearing empty under the “choose folder” dialog may be confusing for my users;
b) I’m not 100% clear about the New/Open/Close purpose for a single-window application;
c) The sheet works well but does not contain the “New folder” button present on the standard dialog.

The Alert sheets, on the other way, are more “intuitively connected” to the window’s content. In these cases, they are perfect and add a great amount of professionalism to my application – and I avoid Obj-C coding :stuck_out_tongue: I shall use and abuse of them!

Thanks you for Myriad Helpers!

Bernard

You can use showModal instead.

It’s there when you expand the dialog.

Just to be clear, it is a standard dialog: it’s just doing a lot of the code in Objective-C, to make it less typing from AppleScript.