Autor Beitrag
ShadowThief
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Mi 01.10.03 18:35 
hallo,

ich hab mir einen record gebaut:

ausblenden Delphi-Quelltext
1:
2:
3:
type TMyRecord = record
 a, b, c: Single;
end;


und ich hab eine variable von diesem typ:

ausblenden Delphi-Quelltext
1:
2:
var
  test: TMyRecord;


kann ich dieser variable auf einmal alle werte zuweisen, anstatt
a, b und c einzeln zuzuweisen, also folgendes:

nicht so:
ausblenden Delphi-Quelltext
1:
2:
3:
test.a := 1.0;
test.b := 2.0;
test.c := 3.0;


sondern:
ausblenden Delphi-Quelltext
1:
test := (1.02.03.0);					


oder halt so ähnlich.

vielen dank.

shadow.
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Mi 01.10.03 18:46 
Mit Konstanen geht das:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
const
  DefValue: TMyRecord = (a: 1.0; b: 2.0; c: 3.0);

var R: TMyRecord;
begin
  R := DefValue; 
// = Move(DefValue, R, SizeOf(R));
end;

_________________
Ist Zeit wirklich Geld?
maximus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 896

Win XP, Suse 8.1
Delphi 4/7/8 alles prof
BeitragVerfasst: Mi 01.10.03 23:14 
mit variablen so:

ausblenden Delphi-Quelltext
1:
2:
var
  test: TMyRecord = (a: 1.0; b: 2.0; c: 3.0);


leider nicht in klassen :?

::Edit:: hab den waren sinn der frage zu spät gesehen :? ...nix für ungut

_________________
mfg.
mâximôv
ShadowThief Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Do 02.10.03 08:15 
ok, ich klassen brauch ichs auch nicht.

vielen dank.