Recent

Author Topic: Native OS X TOpenFile dialog?  (Read 6583 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Native OS X TOpenFile dialog?
« on: September 30, 2012, 10:53:13 pm »
I am trying out the Qt widget set on OS X as I understand Carbon is no longer supported on OS X 10.8 Mountain Lion, and the Cocoa widget set is not complete.

I'm using Qt 4.7.4, as 4.8.1 fails, and Lazarus 1 on OS X 1.6.8 in 64 bit mode.

The first issue I am finding is TFileOpen dialog. Is it possible to use the native OS X dialog?

Aside from esthetics, I can not access files on external drives. The Qt dialog only shows 'Computer' and my user directory. All my data resides on external drives and the Qt dialog does not allow access.

Any help is appreciated.

Cheers,
Frederick

“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Native OS X TOpenFile dialog?
« Reply #1 on: October 01, 2012, 01:15:17 pm »
Yes, build lazarus with -dQT_NATIVE_DIALOGS (and your apps too).

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Native OS X TOpenFile dialog?
« Reply #2 on: October 02, 2012, 03:17:37 pm »
Thank you zeljko!

That worked very well. I did not recompile Lazarus, only my app, as Lazarus works fine.

My understanding is that Qt 4.7.4 is cocoa only, and that Lazarus gui apps are 32 bit only.

Am I correct that my app is now cocoa 32 bit?

Cheers,
Frederick
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Native OS X TOpenFile dialog?
« Reply #3 on: October 02, 2012, 03:23:33 pm »
No,  I don't think that you're right. cocoa is 64bit while carbon is 32bit, so you're using qt carbon 32bit I guess.

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Native OS X TOpenFile dialog?
« Reply #4 on: October 02, 2012, 04:03:24 pm »
Thanks zeljko.

Can anyone confirm? I find references to 32 bit cocoa, and assumed it was running on older 32 bit processors.

I am confused about the status of cocoa/carbon, 32/64 bit. Bottom line is that I want my apps to run on OS X 10.5 to 10.8 with the minimum number of versions I need to compile.

Any info is greatly appreciated.

Cheers,
Frederick
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Native OS X TOpenFile dialog?
« Reply #5 on: October 02, 2012, 09:55:19 pm »
Thanks zeljko.

Can anyone confirm? I find references to 32 bit cocoa, and assumed it was running on older 32 bit processors.

I am confused about the status of cocoa/carbon, 32/64 bit. Bottom line is that I want my apps to run on OS X 10.5 to 10.8 with the minimum number of versions I need to compile.

Any info is greatly appreciated.

LCL Carbon widgetset will give you 32-bit app that can run on 10.5 through 10.8.

Cocoa framework, like other OS X frameworks, is universal for both i386 32-bit and x86_64 64-bit. You can create 32-bit or 64-bit Cocoa apps in Xcode using FPC with custom Xcode templates (ie, LCL not used, so no Carbon limitation):

http://dl.dropbox.com/u/28343282/ObjP/index.html

Apple provides much useful info if you want to want to answer your questions about Carbon:

https://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/Carbon64BitGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004381-CH1-SW1

Thanks.

-Phil



VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Native OS X TOpenFile dialog?
« Reply #6 on: October 03, 2012, 04:37:32 pm »
Thanks Phil.

It is reassuring to know that I will be fine using LCL Carbon for a while yet. I still intend to explore the Qt wigetset as a few things are unimplemented in Carbon, notably file drop.

I will also have a look at your "Developing with Objective Pascal" series, as I am ultimately hoping to target iOS. Unfortunately I do need to keep Windows as a target, so can't get too far away from that.

As always, you are a great help in understanding the Mac / Free Pascal intricacies.

I am still unclear whether Qt 4.7.4 is creating Cocoa apps. I installed:

qt-mac-opensource-4.7.4.dmg

there is another called:

qt-mac-carbon-opensource-4.7.3.dmg

so I think I should be getting Cocoa apps, but I am not sure. Maybe it does not matter? Do you have any knowledge of this?

Cheers,
Frederick
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

 

TinyPortal © 2005-2018