Dumb question:
What is the best way to determine the OS platform at runtime?
I would like to be able to position things like dialog form buttons dependent on the OS.
Thanks,

Mailing lists / lazarus / 2009-01
6 messages · 3 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Dumb question:
What is the best way to determine the OS platform at runtime?
I would like to be able to position things like dialog form buttons dependent on the OS.
Thanks,
Dumb question: What is the best way to determine the OS platform at runtime?
You can already at compile time.
I would like to be able to position things like dialog form buttons dependent on the OS.
For common buttons you can use TButtonPanel.
Mattias
Thanks Mattias. I was aware of the defines but thought maybe there was a built-in function in LCL that returned an enumerated type or constant or something similar.
No problem, I will just create a singleton that relies on the defines to return an enumerated type of my own.
> I would like to be able to position things like dialog form buttons > dependent on the OS. For common buttons you can use TButtonPanel.
Thanks I will this rearrange itself depending on the OS? Is that what you are saying? I have not experience with this component.
Thanks again,
On Tue, 27 Jan 2009 13:01:04 -0500 You can already at compile time.…
Thanks Mattias. I was aware of the defines but thought maybe there was a built-in function in LCL that returned an enumerated type or constant or something similar.
No problem, I will just create a singleton that relies on the defines to return an enumerated type of my own.
Is there a complete list of the defines available. That link seems to show just a few in examples.
> I would like to be able to position things like dialog form buttons > dependent on the OS. For common buttons you can use TButtonPanel.
Thanks I will this rearrange itself depending on the OS? Is that what you are saying? I have not experience with this component.
Thanks again,
Dumb question: What is the best way to determine the OS platform at runtime? I would like…
Lee Jenkins wroteDumb question: What is the best way to determine the OS platform at runtime?
That depends what you expect. OS and architecture are mostly compiletime. FPC/Lazarus mostly busies itself with a very course "os-architecture" combination, but doesn't care much about versions and variants (e.g. win9x and winNT are both "win32")
IOW {$ifdef linux} will return "linux" for a Linux binary, even when it is running on FreeBSD. The opposite would probably also be true if Linux had a FreeBSD emulation mode.
This information can be retrieved in String form using the {$I } directive, as documented in the FPC documentation:
http://www.freepascal.org/docs-html/prog/progsu38.html#x45-430001.1.38
If you want more detailed information, probably you need to go OS specific.
However the unices have a call for this, fpuname:
http://www.freepascal.org/docs-html/rtl/baseunix/fpuname.html
which makes it at least semi-generic.
Thanks Mattias. I was aware of the defines but thought maybe there was a built-in…
Yes.
Mattias