orderFront() help?

Hello everyone,
I’ve finally got my app up and running… mostly. I am having trouble showing a window using orderFront. The window will open, and when I tell it to close it does. But when I re-open the window, the (X) is dark (which symbolizes that it is being closed), and I can’t close the window. Any ideas? (Just a guess, but I think I’ve seen this before, something about “releasing” the window. If that is the case, the checkbox in IB is enabled for Release on close.)

Turn it off and try again.

Try deselecting the “release when closed” check box. That works for me, but you didn’t say how you’re closing it, so I don’t know if your situation is the same.

Ric

i could be barking up the wrong tree here but i had a similar issue, Shane supplied me with this snippet.
which needs to be linked in ib to your window.

property ApplicationName : missing value

on applicationShouldHandleReopen_hasVisibleWindows_(self, visible)
	if visible then
		return true
	else
		-- ApplicationName is an outlet that's linked to the main Window in IB
		ApplicationName's makeKeyAndOrderFront_(self)
		return false
	end if
end applicationShouldHandleReopen_hasVisibleWindows_

Rdelmar, I am closing the window by clicking the (X) button on top of the window. For some reason, your snippet didn’t work for me Budgie… Also, I tried it with “release window on close” off. The same issue happened.

And how are you reopening? With orderFront_, called how? A button? I don’t think we can help any more without seeing some code.

Ric

Okay, I am opening and reopening with orderFront (I think that is my problem.) Here is the code that is set up to a button.

    on openPrefs_(sender)
        prefsWindow's orderFront_(me)
    end openPrefs_  

try this TechExpertHD

on openPrefs_(sender)
		prefsWindow's |makeKeyAndOrderFront_|(me)
      end openPrefs_ 

I still get the error… but thanks for trying Budgie! The more I think about it, it seems that I am simply bringing a closed window to the front. Is there something else I could use besides makeKeyAndOrderFront: or something like that?

Do you mean the whole circle is dark, or do you mean there’s a black dot in the middle?

The whole circle is dark, basically it looks like someone clicked on it then it froze.

Could it be that your app is frozen? Are there any other UI elements that you can click on to see if they are responsive? Is “orderFront” the only thing you are doing in your method, or is there something else that you are doing at the same time that might be causing a freeze?

Ric

After Edit: Ignore the above. I was able to duplicate your behavior with two windows. The button to open the second (prefs) window is in the main window, and after closing the prefs window and clicking on the open button in the main window, the prefs window opens but the close button is darkened and doesn’t work. However, for me, this only happens when the “Release on close” check box is selected for the prefs window – it works normally if I deselect that. Are you sure you deselected that for your prefs window, and not for your main window?

I made a new project, copied my code, and turned off release on close and it worked. Hmmm don’t know why it didn’t work before but thanks Rdelmar!