Splash with status

Hi,

In my app I want to show a splash (window or panel without a title) that show label with some info in progress like “Autentication…”

I inserted handler inside applicationDidFinishLaunching_

When I run app from inside Xcode the splash never go in foreground (the splash is back to the Xcode windows).
When I launch app compiled I see the splash.

But looking the menu bar seems that the app is really active when the applicationDidFinishLaunching_ finish

I looked for something like “applicationIsLaunched” but don’t exists in API’s.

Any suggestion?

Ame

As om not on my mac right nog, i can’t Try it out but Try this, Assuming you use asoc:

Splashwindow’s orderFront_(me)

Should order it in front of other windows

Hi Xpresso,

I have try like you suggest but nothing.

summaryzing this is all:

on applicationWillFinishLaunching_(aNotification)
	log "applicationWillFinishLaunching_"
end applicationWillFinishLaunching_


on applicationDidFinishLaunching_(notification)
	log "applicationDidFinishLaunching_"
	verifyPrivileges()
end applicationDidFinishLaunching_


on verifyPrivileges()
	tell current application's Privileges to set response to checkPrivileges()
	do shell script "/bin/sleep 2"
	pSplash's orderOut_(me)
	pMainWin's makeKeyAndOrderFront_(me)
end verifyPrivileges

The splash has been created with panel visible at launch without a title.
I need it only to show the logo of the app, the name of the app, version… and progress that check if app can run on that machine through a validation process.
But when I launch the app the splash appear but menu bar is related to the Finder.
When splash disappear (after the 2 seconds) the app show the main window and menu bar is related to the app.
The question is: why when I build and run from Xcode the splash remain in background. I need to move all xcode window to see it.
Why when app starts and the splash screen appear the menu bar is not the menu bar of the app?

Ame

I tried to change and using performSelector_withObject_afterDelay_ instead of sleep.
Seems better but if my windows has a title bar all works good.
If I remove the Title bar the splash window never appear in foreground.

script AppDelegate
	property parent : class "NSObject"
	
	property pMainWin : missing value
	property pSplashWin : missing value
	
	on applicationWillFinishLaunching_(aNotification)
		-- Insert code here to initialize your application before any files are opened 
	end applicationWillFinishLaunching_
	
	on applicationDidFinishLaunching_(aNotification)
		pSplashWin's makeKeyAndOrderFront_(me)
		performSelector_withObject_afterDelay_("closeSplash", missing value, 2)
	end applicationDidFinishLaunching_
	
	on applicationShouldTerminate_(sender)
		return current application's NSTerminateNow
	end applicationShouldTerminate_
	
	on closeSplash()
		pSplashWin's orderOut_(me)
		pMainWin's makeKeyAndOrderFront_(me)
	end closeSplash
	
end script

Ame

Oh, so you want a splash window without the controls (close, minimize, and that other button)?

I’m not very experienced with that, but i do know that you would need a Custom view, i tried something with it while applescript was still in the studio area. It should be easier atm. I’ll see if i can make something working myself…

Hi âme,

I just thought of something. My main window always opens in front of Xcode. Try comparing the settings for your window and the main window.

gl,
kel

Hi Kel,

I double checked all the settings but nothing.
Splash window never appear in foreground when I run the project from Xcode.
What I would like to to is a simple splash screen like when you launch Photoshop with some info.
After 2/3 sec splash will close and main window will appear.

Ame

Hi Kel,

please try to remove the title bar from window.
Are you using a window or panel?

Ame

Does it really matter how it works when you are running it in XCode? because that environment is not the same as when you compile and distribute your app. I think you are worried about a behavior that doesn’t matter in the Xcode debugging mode. You could also try putting the code in awakeFromNib.

Hi âme,

I removed the title bar and you are right. I just thought of something. Maybe if you activate the app in the script for testing purposes, then the window might come to the front.

gl,
kel

Yeah, it worked. I added the activate for testing purposes:

on applicationDidFinishLaunching_(aNotification)
        activate me
        return
    end applicationDidFinishLaunching_

gl,
kel

Personally, I think this is a bug in Mountain Lion. When I run an AppleScript and use the ‘activate’ command, many application windows open behind the previous current application. There’s a bug in there somewhere. e.g.

tell application "Notes"
	activate
end tell

Notes’ window doesn’t come to the front of the Script Editor. You need a launch and activate.

You could change the splash window to a Utility Panel and then configure the panel using Attributes Inspector to keep the panel above all other windows… and remove/add the close/restore/minimize buttons and titlebar