AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Call procedure

Ein Thema von question · begonnen am 26. Aug 2013 · letzter Beitrag vom 26. Aug 2013
Antwort Antwort
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

Call procedure

  Alt 26. Aug 2013, 14:25
Code:
Unit1 
public
procedure Add(Sender: Tobject)
......
Procedure TFrom1.ADD(Sender:Tobject);
begin
....
end;


Unit2
Procedure Done(Sender:Tobject);

uses
  unit1;

var
 TTest : TForm1;

Procedure TFrom2.Done(Sender:Tobject);
begin
TTest.Add(Sender);
end;
i get the error "Zugriffsverletzung bei Adresse 00C683D7 in Modul 'test.exe'. Lesen von Adresse 00000028."
i have also tried with TTest,create(nil); but i always get this error message, how can i overcome it?
  Mit Zitat antworten Zitat
Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#2

AW: Call procedure

  Alt 26. Aug 2013, 14:33
You're not getting runtime errors out of nowhere. What did you do? What happens first? Which lines causes the error? You can find it out all yourself by using the built-in debugger.

However, the "Access violation when trying to read 00000028" sounds pretty much like calling an objects method without creating it first. The reference you're using simply does not point to an existing object.
  Mit Zitat antworten Zitat
Benutzerbild von baumina
baumina

Registriert seit: 5. Mai 2008
Ort: Oberschwaben
1.275 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: Call procedure

  Alt 26. Aug 2013, 14:35
Create a form like
TTest := TForm1.Create(Application); or TTest := TForm1.Create(Nil);

and dont forget to free the Form after using
TTest.Free;
Hinter dir gehts abwärts und vor dir steil bergauf ! (Wolfgang Ambros)
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: Call procedure

  Alt 26. Aug 2013, 15:16
There is no need to free a TComponent if you specified an owner on its creation.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#5

AW: Call procedure

  Alt 26. Aug 2013, 15:40
I have one class

Type
TCar = class(Tobject)

i would like to add another class TMen inside TCar class, how can i add another class inside a Class?
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#6

AW: Call procedure

  Alt 26. Aug 2013, 15:44
Delphi-Quellcode:
type
  TMyOtherClass = class
    (* Fields, Methods, Properties *)
  end;

  TMyClass = class
  private
    FMyOtherClass: TMyOtherClass;
    (* More Fields, Methods, Properties *)
  end;
Depending on your intention you have to create the "FMyOtherClass"-instance somewhere (e.g. within the constructor of TMyClass) and free it within the destructor to avoid memoryleaks.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:32 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