Recent

Author Topic: Can't Highlight default button on MacOSX Carbon  (Read 6919 times)

dbcbos

  • Newbie
  • Posts: 6
Can't Highlight default button on MacOSX Carbon
« on: February 26, 2012, 11:03:12 am »
If I make a button the default one on my program the button doesn't show the button highlighted. Is this a limitation. I see it highlighted in the lazarus ide though, so I think I should be able to do so too. What am I missing?

I installed on Mac OSX Lion 10.7.3:
fpc 2.4.4
fpc 2.4.4 source
Lazarus 0.9.30.2

I plunged a few buttons on the form and set one of the buttons property default to true.

On other IDE's this is sufficient to get the button highlighted

If I press enter it works, but it doesn't highlight it like in other osx programs.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Can't Highlight default button on MacOSX Carbon
« Reply #1 on: February 26, 2012, 12:42:58 pm »
It seems to depend from the version of the operating system. In my experience, default highlighting works on Mac OS X 10.4. From Mac OS 10.5 upwards the button style has been modified, and it is impossible to visualize it as being the default widget.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: Can't Highlight default button on MacOSX Carbon
« Reply #2 on: February 27, 2012, 11:02:10 am »
There is no highlight with carbon for buttons, if you really need it you must use qt or gtk.

BTW Where do you see highlighted buttons in IDE? Maybe on confirmation dialogs? They are different type of buttons and their behavior may be different.
« Last Edit: February 27, 2012, 11:05:27 am by Shebuka »

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Can't Highlight default button on MacOSX Carbon
« Reply #3 on: February 27, 2012, 08:30:31 pm »
There is no highlight with carbon for buttons, if you really need it you must use qt or gtk.

This information is not correct. Certainly default buttons are supported by carbon, and this also worked with Lazarus up to Mac OS X 10.4 (Tiger). Beginning with Mac OS X 10.5 (Leopard) the appearance of buttons changed (indeed they look much better). However, the default button is no longer highlighted.

Interestingly, this is not a flaw of the newer Mac OS versions, where default buttons are still supported. And it is not a bug of Lazarus itself, as the same application compiled with the same Lazarus version shows a default button on Mac OS Tiger but not on Leopard. It seems to be the specific combination of Lazarus-generated code and certain Mac OS versions.

In order to cite Apple: "A default button pulses and is the button that's selected when the user presses Return" [Troy Mott, Apple Computer, Inc. Learning Carbon. O'Reilly Media, Inc., 2001]
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: Can't Highlight default button on MacOSX Carbon
« Reply #4 on: February 28, 2012, 10:27:47 am »
The applications compiled for Tiger are not working on Snow Leopard+, you need separated binaries in same bundle to make it work because Tiger and Snow Leopard+ are like different worlds.

dbcbos has Lion, so i cit myself: "There is no highlight with carbon for buttons"... exception is dialog type windows. But yes, if you find 10.4 SDK for Lion, manage to install it, build separate binaries and merge them in one universal binary (or distribute separate bundles), with Tiger you will got default highlight button.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Can't Highlight default button on MacOSX Carbon
« Reply #5 on: February 28, 2012, 07:27:27 pm »
The applications compiled for Tiger are not working on Snow Leopard+, you need separated binaries in same bundle to make it work because Tiger and Snow Leopard+ are like different worlds.

Sorry, but this is again not correct. The same binaries can run on Tiger, Leopard, Snow Leopard and Lion (and probably Mountain Lion, too). Of course you need different binaries for the respective processor architecture (PPC or Intel), but not for different OS versions.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

dbcbos

  • Newbie
  • Posts: 6
Re: Can't Highlight default button on MacOSX Carbon
« Reply #6 on: February 28, 2012, 09:49:09 pm »
First of all thank you for your replies.

It's a shame it is a limitation. Hoped perhaps by installing a higher fpc I could get around it, but alas that probably won't work either. Then again with Lazarus not being at version 1 yet and the things I saw in the wiki pages about things not working right on mac osx, I think it's not running so badly on my mac.

I got some more questions about some things i could do in Delphi that I like to do in Lazarus on Mac, I hope you can help with those too. In good order I'll make a new thread for those.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Can't Highlight default button on MacOSX Carbon
« Reply #7 on: February 28, 2012, 10:05:03 pm »
I think this is a flaw in the Carbon widgetset. It may be an idea to submit a bugreport in the bugtracker system.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Can't Highlight default button on MacOSX Carbon
« Reply #8 on: March 09, 2012, 08:08:55 am »
The solution is in topic http://www.lazarus.freepascal.org/index.php/topic,12205.0.html of this forum. Setting the button height to 22 does the trick.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

 

TinyPortal © 2005-2018