Autor Beitrag
Ice
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Mo 03.02.03 12:16 
Hallo Leute,

ich habe ein Problem mit folgendem Quelltext:
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
unit PrimaryDevice;

interface

uses
  Windows, Messages, SysUtils, Classes, Controls, ExtCtrls, Dialogs, QGraphics, StdCtrls;

type
  TPrimaryDevice = class(TPanel)
  private
   function  Get_DevType   : String;
   function  Get_Radio     : boolean;
   procedure Set_DevType(const Typ: String);
   procedure Set_Radio(const Radio: boolean);
  protected
    { Protected-Deklarationen }
  public
    constructor Create(AOwner:TComponent);override;
    destructor  Destroy;override;
  published
   property GeraeteName : string read Get_DevType write Set_DevType;
   property Funk       : boolean read Get_Radio write Set_Radio;
  end;
var
 Funk : boolean;
 DevType : String;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Zusätzlich', [TPrimaryDevice]);
end;

constructor TPrimaryDevice.Create(AOwner:TComponent);
begin
 inherited Create(AOwner);
 width := 12;
 height:= 12;
 color := clred;
end;

destructor TPrimaryDevice.Destroy;
begin
 inherited destroy;
end;

function TPrimaryDevice.Get_DevType:string;
begin
 result := DevType
end;

function TPrimaryDevice.Get_Radio:boolean;
begin
 result := Funk;
end;

procedure TPrimaryDevice.Set_DevType(const Typ:string);
begin
 DevType := Typ;
end;

procedure TPrimaryDevice.Set_Radio(const Radio:boolean);
begin
 Funk := Radio;
end;
end.


wenn ich diese Komponente dann in ein Formular einsetze kommt eine Meldung:
Zitat:
Gefahr Stapelüberlauf speichern sie ihre Arbeit und starten sieDelphi erneut

Woran liegt das?

Vielen Dank schonmal.

Ice

Moderiert von user profile iconTino: Code- & Quote-Tags hinzugefügt.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 03.02.03 13:37 
Hallo,

bennen mal deine globalen Variablen Funk und DevType um. Nicht vergessen in den Proceduren die Variablen auch umzubennen.

Gruß
TINO
Ice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Mo 03.02.03 13:37 
Okay ich habe es gefunden,

die Variable und die Property Funk haben denselben Namen :oops: und so kommt es zum Speicherüberlauf!
Habe die variable umbenannt und es funktioniert!
:)

trotzdem vielen dank an alle die sich die mühe gemacht haben sich damit zu beschäftigen...

mfg

Ice