Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Die Delphi-IDE (https://www.delphipraxis.net/62-die-delphi-ide/)
-   -   Klassenvervollständigung und set of Byte (https://www.delphipraxis.net/200618-klassenvervollstaendigung-und-set-byte.html)

Edelfix 8. Mai 2019 09:00

Klassenvervollständigung und set of Byte
 
Hallo,

Wenn ich in einer Klassendeklaration per STRG-SHIFT-C vervollständigen lasse, dann kommt die Fehlermeldung: "END erwartet, aber SET gefunden in Klasse TMyRec".


In folgendem code:

Delphi-Quellcode:
unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TMyRec = packed record
    Aset: set of Byte;
  end;


  TForm2 = class(TForm)
    Button1: TButton;
  private
    procedure TestProc;
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

end.
Was muss ich ändern damit die Fehlermeldung nicht mehr kommt? Manuell funktioniert der code.

Neutral General 8. Mai 2019 09:13

AW: Klassenvervollständigung und set of Byte
 
Es klappt wahrscheinlich wenn du einen Typen für das set of Byte deklarierst und den stattdessen im Record verwendest.

Edelfix 8. Mai 2019 14:27

AW: Klassenvervollständigung und set of Byte
 
Vielen Dank.

Manchmal ist es ganz einfach.

So geht es:

Delphi-Quellcode:
unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TmySetOfByte = set of Byte;

  TMyRec = packed record
    Aset: TmySetOfByte;
  end;


  TForm2 = class(TForm)
    Button1: TButton;
  private
    procedure TestProc;
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

{ TForm2 }

procedure TForm2.TestProc;
begin
//
end;

end.


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:03 Uhr.

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