![]() |
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Jetzt habe ich doch noch eine Frage!
Wie kann ich denn jetzt von meinem RegForm aus auf die Variablen meiner Klasse zugreifen? |
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Zitat:
Stattdessen bietet TRegForm ein oder mehrere Properties an:
Delphi-Quellcode:
else begin
// RegForm anzeigen Application.ShowMainForm := false; RegForm := TRegform.create(nil); // Daten an Regform übergeben RegForm.ApplicationName := self.fApplicationName; if RegForm.showmodal = mrOK then begin // und auch entgegen nehmen self.regkey := RegForm.RegKey; end; end; |
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Oh das wusste ich nicht! Danke für deine Hilfe.
Habe nur ein Problem, der kann mit der Zeile hier nichts anfangen...
Delphi-Quellcode:
..
RegForm.ApplicationName := self.fApplicationName; .. Zitat:
|
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Hast Du denn eine Property ApplicationName im RegForm deklariert?
|
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Hatte ja am Anfang kurz geschrieben, dass das meine erste Kompo ist. Ich wusste nicht das ich noch eine property im RegForm anlegen muss.
Muss ich dann auch noch eine Property in meiner Klasse anlegen die ApplicationName heißt? Ist das so für das Formular richtig?
Delphi-Quellcode:
public
{ Public-Deklarationen } property ApplicationName: string; end; |
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Besser wäre
Delphi-Quellcode:
Und im Konstruktor FApplicationName gleich auf '' setzen.
private
FApplicationName: string; public property ApplicationName: string read FApplicationName write FApplicationName; end; |
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Also ich vermute mal das ich etwas falsch mache, denn der Wert wird nicht angezeigt.
mein RegForm
Delphi-Quellcode:
...
unit RegForm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TRegForm = class(TForm) Button1: TButton; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Edit6: TEdit; Edit7: TEdit; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Button2: TButton; Button3: TButton; procedure Button2Click(Sender: TObject); private { Private-Deklarationen } FApplicationName: String; public { Public-Deklarationen } FRegCode: String; FRegWebsite: String; FRegExeName: String; FRegExtension: String; FRegFileName: String; FRegCustomerName: String; FRegCustomerEmail: String; FRegCustomerSerial: String; property ApplicationName: string read FApplicationName write FApplicationName; end; var RegForm: TRegForm; implementation {$R *.dfm} procedure TRegForm.Button2Click(Sender: TObject); begin showmessage(fregcode); end; end. ... Und in meiner Klasse steht jetzt
Delphi-Quellcode:
...
strict private { Private-Deklarationen } ... FApplicationName: String; public { Public-Deklarationen } property ApplicationName : string read FApplicationName write FApplicationName; ... |
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Wo wird er nicht angezeigt?
|
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Im RegForm mit der Methode
Delphi-Quellcode:
procedure TRegForm.Button2Click(Sender: TObject); begin showmessage(fregcode); end; |
Re: Komponente - Constructor MainForm.Hide = Access Violatio
Du setzt eine Property ApplicationName und fragst dann eine Variable fRegCode ab? :gruebel:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:31 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