Recent

Author Topic: launching OS X application  (Read 5532 times)

Julius

  • New Member
  • *
  • Posts: 11
launching OS X application
« on: November 05, 2011, 08:32:31 am »
Hello,

I've installed lazarus on my intel mac snowleopard. Created a "hello world" application - just a button showing messagebox, nothing special. When I hit run button - it compiles and works ok.

The problem arrises when I try to run the binary file of the newbuilt application. The terminal window appears, I see the application window, but it is inactive for some reason.

I am new to mac os. I've been programming for windows and linux until now...

OS:  SnowLeopard
System version: Mac OS X 10.6.8
Kernel: Darwin 10.8.0
XCode: 3.2.6
FPC: 2.4.2
Lazarus 0.9.30

Using carbon LCL widget set.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: launching OS X application
« Reply #1 on: November 05, 2011, 08:39:09 am »
How are you running the application? From Lazarus?

In any case, go to Project->Project Options

Select "Use Application Bundle"
Click in the button "Create Application Bundle"
and try again running from Lazarus.

Julius

  • New Member
  • *
  • Posts: 11
Re: launching OS X application
« Reply #2 on: November 05, 2011, 08:53:50 am »
Quote
How are you running the application? From Lazarus?
From lazarus I'm running it by clicking "Run" buttont (the green triangle). It works Ok.
From Console window I'm running it clicking project1 from the file manager.

Quote
Select "Use Application Bundle"
Click in the button "Create Application Bundle"
and try again running from Lazarus.
Did all that. Still ok when running from Lazarus, problems when from filemanager.

In the terminal window I see "TCarbonButton.SetFocus Error: SetKeyboardFocus failed with result -30585. The message does not appear if i run the project using sudo, but the bahavior remains, so I doubt it is the root of the problem..

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: launching OS X application
« Reply #3 on: November 05, 2011, 09:04:17 am »
From lazarus I'm running it by clicking "Run" buttont (the green triangle). It works Ok.
From Console window I'm running it clicking project1 from the file manager.

Ok, now I see. There is no problem, this is just how Carbon works. Carbon applications *must be run* from the Bundle.

You cannot run the executable. To run the Bundle open a terminal and type something like this:

cd myproject
open project1.app

Julius

  • New Member
  • *
  • Posts: 11
Re: launching OS X application
« Reply #4 on: November 05, 2011, 09:17:57 am »
Oh... didn't know that. Thank you.

If I have used cocoa - would I be able to execute it (not open)?

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 805
Re: launching OS X application
« Reply #5 on: November 05, 2011, 09:55:25 am »
If I have used cocoa - would I be able to execute it (not open)?

This has nothing to do with Carbon vs Cocoa. You can change this behaviour by explicitly calling TransformProcessType though: http://developer.apple.com/library/mac/#documentation/Carbon/Reference/Process_Manager/Reference/reference.html#//apple_ref/c/func/TransformProcessType (yes, that call is technically part of "Carbon", but it applies equally to Cocoa applications: http://www.cocoadev.com/index.pl?TransformProcessType -- at the low level, Carbon and Cocoa are completely interdependent and use each other's facilities all the time).

Julius

  • New Member
  • *
  • Posts: 11
Re: launching OS X application
« Reply #6 on: November 05, 2011, 10:40:06 am »
Thank you both jmaebe and felipemdc for the help.

Starting something new is usually not an easy task. It's good to have you guys!

 

TinyPortal © 2005-2018