>Subject: RE: Getting Date at build time
>From: Richard Anderson <[EMAIL PROTECTED]>
>Date: Mon, 12 Feb 2001 09:54:29 -0000
>X-Message-Number: 8
>
>Thanks for that.
>
>Do you know anyway to get this in constructor, or will I have to write =
>an
>event handler for my about box, to call the macros ?
If you don't care about the formatting of the date, then the easy way
to do this is to have a label in your about box which is set (in
Constructor) to be "XXXXXXXXXXXXXXX", where the number of 'X'
characters is greater than the max length of the compiler-generated
date. In your about box code, you would do:
FormType* frmP = FrmInitForm(AboutForm);
FrmCopyLabel(frmP, AboutBuildLabel, __DATE__);
FrmDoDialog(frmP);
FrmDeleteForm(frmP);
So no, you don't need an event handler.
I think there might be a minor issue in that this gives you the date
that the compiler compiled your about box code, which might not be
the same as the date that you built the app, if the source didn't
need to be recompiled.
If you care about the date formatting, then it gets harder. You'd add
a .r (Rez) file to your project, which would contain something like
this:
#include "UIResDefs.r" // 'tint' resource type.
resource 'tint' (1000)
{
$$Year
};
resource 'tint' (1001)
{
$$Month
};
resource 'tint' (1002)
{
$$Day
};
Rez will automatically replace the $$Year with 2001, $$Month with 2,
and $$Day with 13. Now in your app code, you'd do something like:
Char buildString[dateStringLength + 1];
DateToAscii( ResLoadConstant(1001),
ResLoadConstant(1002),
ResLoadConstant(1000),
(DateFormatType)PrefGetPreference(prefDateFormat),
buildString);
And then you could set the form label to buildString. This will give
you the date that the .prc was actually generated, since Rez is
always run as part of that process.
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/