Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Records nach ausen unsichtbar machen (https://www.delphipraxis.net/86781-records-nach-ausen-unsichtbar-machen.html)

xZise 19. Feb 2007 17:15


Records nach ausen unsichtbar machen
 
Wie kann ich records die die als Typen deklariert habe, nur in der akt. Unit sichtbar machen?

mkinzler 19. Feb 2007 17:18

Re: Records nach ausen unsichtbar machen
 
In dem du sie im Implementation Teil deklarierst

xZise 19. Feb 2007 17:28

Re: Records nach ausen unsichtbar machen
 
Allerdings, funktioniert das nicht ganz so :P
Delphi-Quellcode:
implementation

type
   TApplicationData = record
    name, serial, registryKey, adcDir, notices : string;
  end;

  TApplicationMain = record
    mainApplication : TApplicationData;
    addons : array of TApplicationData;
  end;

  TApplicationGroup = record
    name : string;
    applications : array of TApplicationMain;
  end;
Zitat:

[Pascal Fehler] uApplicationData.pas(32): E2004 Bezeichner redefiniert: 'TApplicationData'
[Pascal Fehler] uApplicationData.pas(32): E2004 Bezeichner redefiniert: 'TApplicationData'
Und die Klasse, die diese Records benötigt spukt dann auch Fehlermeldungen aus...

mkinzler 19. Feb 2007 17:31

Re: Records nach ausen unsichtbar machen
 
Wird der Record auch im Interface deklariert?
Wo ist die Klasse deklariert, welche den Record verwenden soll?

Cöster 19. Feb 2007 17:32

Re: Records nach ausen unsichtbar machen
 
Siehe dazu auch hier die ersten 4,5 Posts (danach wurd's OT :wink: ). Da hatte ich die gleiche Frage zu Klassen gestellt.

xZise 19. Feb 2007 19:35

Re: Records nach ausen unsichtbar machen
 
Zitat:

Zitat von mkinzler
Wird der Record auch im Interface deklariert?

Die Records habe ich jetzt natürlich im impementation-Teil
Zitat:

Zitat von mkinzler
Wo ist die Klasse deklariert, welche den Record verwenden soll?

Interface
Delphi-Quellcode:
interface

type

  TApplicationCollection = class(TObject)
  private
    FApp : array of TApplicationGroup;

    FNewGroupName, FNewApplicationName : string;

    function getApplicationData(AGroup, ASelected,
      AAddon: Integer): TApplicationData;
    procedure setApplicationData(AGroup, ASelected, AAddon: Integer;
      const Value: TApplicationData);
  public
    property ApplicationData[AGroup : Integer; ASelected : Integer; AAddon : Integer] : TApplicationData read getApplicationData write setApplicationData;
    property NewGroupName : string read FNewGroupName write FNewGroupName;
    property NewApplicationName : string read FNewApplicationName write FNewApplicationName;

    procedure addGroup(name : string; index : Integer = -1);
    procedure addApplication(const AGroup, index : Integer; const AData : TApplicationData);
    procedure addAddon(const AGroup, ASelected, index : Integer; const AData : TApplicationData);

    constructor Create(ANewGroupName, ANewApplicationName : string);
  end;

implementation

type
   TApplicationData = record
    name, serial, registryKey, adcDir, notices : string;
  end;

  TApplicationMain = record
    mainApplication : TApplicationData;
    addons : array of TApplicationData;
  end;

  TApplicationGroup = record
    name : string;
    applications : array of TApplicationMain;
  end;
Zitat:

Zitat von Cöster
Siehe dazu auch hier die ersten 4,5 Posts (danach wurd's OT :wink: ). Da hatte ich die gleiche Frage zu Klassen gestellt.

Subklassen klingen gut ...


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:55 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