I like this a lot !!!:

  TGalleryStatusDescriptions: array
[Low(TGalleryStatus)..High(TGalleryStatus)] of String =

I have been trying to find out where I can use other variables in array
declarations.  I hoped I could use previously declared constants, I did not
know I could use a function that the compiler must obviously resolve as it
compiles.  I am guessing that the other array (TGalleryStatus here) has to
be (a) a constant array, and (b) declared before the
TGalleryStatusDescriptions array is declared?

Anywhere I can read up more on this, as I use lots of related arrays and
this is most handy.

Aside - In general the high and low functions are most useful - especially
as I use many one based arrays and if I pass the array as an open array
parameter to a procedure then it becomes a zero based array inside the
procedure, and using low and high inside the procedure avoids a lot of
potential errors... :)

John


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Conor Boyd
Sent: Thursday, 10 May 2007 11:32 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] Why use a set when a string will work OK (and less code)?


Yes, or if you want more control over your descriptive values, then you can
do something like this:

  TGalleryStatus = (gsUnknown, gsSuccess, gsMajVerInvalid,
gsMinorVerInvalid, gsVerFmtInvalid, gsVerMissing, gsPasswordWrong,
                    gsLoginMissing, gsUnknownCommand, gsNoAddPermission,
gsNoFilename, gsUploadFailed,
                    gsNoWritePermission, gsNoCreateAlbumPermission,
gsCreateAlbumFailed, gsURLNotFound404Error,
                    gsImageNotLoaded, gsNetworkError, gsNoWriteableAlbums,
gsOffline, gsNoViewPermission,
                    gsMoveAlbumFailed, gsRotateImageFailed);

  TGalleryStatusDescriptions: array
[Low(TGalleryStatus)..High(TGalleryStatus)] of String =
    ('Unknown response or other failure.',
     'The command the client sent in the request completed successfully. The
data (if any) in the response should be considered valid.',
     'The protocol major version the client is using is not supported.',
     'The protocol minor version the client is using is not supported.',
     'The format of the protocol version string the client sent in the
request is invalid.',


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to