Mac Buttons: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Mac Buttons
| Old | New | Line | |
|---|---|---|---|
| 1 | + | *(macOS only)* | |
| 2 | + | ||
| 3 | + | By default, the button placed onto a form by Lazarus is 75 width by 25 height, which is not the standard for Mac Applications. | |
| 4 | + | ||
| 5 | + | In order for buttons to appear oval, make the button height 22 maximum. | |
| 6 | + | ||
| 7 | + | This can be done by setting the button height directly or through code. | |
| 8 | + | ||
| 9 | + | ## CODE FOR A SINGLE BUTTON: | |
| 10 | + | ||
| 11 | + | ``` pascal | |
| 12 | + | procedure TForm1.FormCreate(Sender: TObject); | |
| 13 | + | begin | |
| 14 | + | Button1.Height := 22; | |
| 15 | + | end; | |
| 16 | + | ``` | |
| 17 | + | ||
| 18 | + | ## CODE FOR ALL BUTTONS: | |
| 19 | + | ||
| 20 | + | ``` pascal | |
| 21 | + | procedure TForm1.FormCreate(Sender: TObject); | |
| 22 | + | var | |
| 23 | + | I: Integer; | |
| 24 | + | begin | |
| 25 | + | for I := 0 to Form1.ControlCount - 1 do begin | |
| 26 | + | if (Form1.Controls[I].ClassType = TButton) then Form1.Controls[I].Height := 22; | |
| 27 | + | end; | |
| 28 | + | end; | |
| 29 | + | ``` | |
| 30 | + | ||
| 31 | + | ## See also | |
| 32 | + | ||
| 33 | + | - [[Introduction to platform-sensitive development]] | |
| 34 | + | - [[Mac Show Application Title, Version, and Company]] | |
| 35 | + | - [[Add an Apple Help Book to your macOS app]] | |
| 36 | + | - [[macOS Programming Tips]] | |
| 37 | + | ||
| 38 | + | --- | |
| 39 | + | *From the Free Pascal wiki, page "Mac Buttons", as it stood on 2019-12-18 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
