Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Record als Const? (https://www.delphipraxis.net/37986-record-als-const.html)

Kedariodakon 13. Jan 2005 11:14


Record als Const?
 
Kann ich ein Record irgendwie als const definieren? :gruebel:

Das ist mein record oder besser Delphis Record :zwinker:
Delphi-Quellcode:
type
  TFormatSettings = record
    CurrencyFormat: Byte;
    NegCurrFormat: Byte;
    ThousandSeparator: Char;
    DecimalSeparator: Char;
    CurrencyDecimals: Byte;
    DateSeparator: Char;
    TimeSeparator: Char;
    ListSeparator: Char;
    CurrencyString: string;
    ShortDateFormat: string;
    LongDateFormat: string;
    TimeAMString: string;
    TimePMString: string;
    ShortTimeFormat: string;
    LongTimeFormat: string;

    ShortMonthNames: array[1..12] of string;
    LongMonthNames: array[1..12] of string;
    ShortDayNames: array[1..7] of string;
    LongDayNames: array[1..7] of string;
    TwoDigitYearCenturyWindow: Word;
  end;
Nun will ich ne Konstante MyFS mit festen Werten haben...
Tut das gehn? :?:


Bye

Sharky 13. Jan 2005 11:21

Re: Record als Const?
 
Hai Kadariodokon,

schaue mal in der Hilfe nach Delphi-Referenz durchsuchenRecord-Konstanten
Delphi-Quellcode:
type TmyTest = Record
       blubb : String;
       foo  : Integer;
     end;

const
  myTest : TMyTest = (blubb:'hallo';foo:23);

tommie-lie 13. Jan 2005 11:22

Re: Record als Const?
 
Delphi-Quellcode:
MyFS: TFormatSettings = (
  CurrencyFormat: 1;
  NegCurrFormat: 2;
  ThousandSeparator: ' '
  // ...);
Dabei müssen nicht alle Felder auch vorbelegt werden.


Edit: Och menno, diese doofen Moderatoren, die kommen immer als erstes dran... http://dpchat.dpexperte.de/smileys/icon_mecker.gif

Kedariodakon 13. Jan 2005 11:26

Re: Record als Const?
 
Schon gefunden ^^
Bin heut zu pöd zum suchen...

Delphi-Quellcode:
Const
  MyFS: TFormatSettings = (
            CurrencyFormat:           3;
            NegCurrFormat:            8;
            ThousandSeparator:        '.';
            DecimalSeparator:         ',';
            CurrencyDecimals:         2;
            DateSeparator:            '.';
            TimeSeparator:            ':';
            ListSeparator:            ';';
            CurrencyString:           '';
            ShortDateFormat:          '';
            LongDateFormat:           '';
            TimeAMString:             '';
            TimePMString:             '';
            ShortTimeFormat:          '';
            LongTimeFormat:           '';
            ShortMonthNames:          ( '', '', '', '', '', '', '', '', '', '', '', '');
            LongMonthNames:           ( '', '', '', '', '', '', '', '', '', '', '', '');
            ShortDayNames:            ( '', '', '', '', '', '', '' );
            LongDayNames:             ( '', '', '', '', '', '', '' );
            TwoDigitYearCenturyWindow: 2 );
Bye

Robert Marquardt 13. Jan 2005 12:51

Re: Record als Const?
 
Zitat:

Zitat von Kedariodakon
Bin heut zu pöd zum suchen...

Das mit der Rechtschreibung scheint auch nicht zu gehen :-)


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:54 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz