Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-08

StatusItem in a Carbon app

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tobias Giesen

Hello,

I've been able to use the pascocoa sample code to add a status item to my Carbon app, and it works to some extent. At first it did not respond to clicks, so I switched from using Application.run to NSApp.run. Now the events for both my Carbon app and the status item seem to be processed OK, but sometimes the app just terminates itself.

Is there a way to stick to Application.Run but deliver events for the NSApp too? Or set up the event handlers for the NSApp?

Cheers,
Tobias

Reply by email

Tobias Giesen
to Tobias Giesen

Hello,

I solved it. In TMyController, I just need to make sure that the function applicationShouldTerminateAfterLastWindowClosed always returns objc.NO. Apparently the NSApp doesn't see the Carbon windows, so it queries whether to close the application occasionally.

It is fascinating, so far I haven't found any side effects of replacing Application.run with NSApp.run. Quite surprising. Of course I had to show the main form before calling NSApp.run but that was it. Well we will see what happens next.

Cheers
Tobias

Reply by email