Autor Beitrag
kiwicht
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Di 08.04.03 09:51 
Schönen guten Morgen zusammen...

aaaaalso, folgendes Prob:

Ich hab ne Child-Form, die wird in einem OnButtonClick des HauptFensters aufgerufen. Im OnCreate-Ereigniss dieser ChildForm rufe ich die Funktion einer externen Unit auf. In dieser Unit wiederum, ändere ich die eigenschaften verschieden DBEdit-Felder meiner ChildForm.

mal kurzer Auszug:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
ChildForm.OnCreate;
begin
  initDBFelder;
end;

unit initDB;

proc initDBfelder;
begin
with ChildForm do begin
DBEdit1.DataField := ...
[...]
end; // with
end; // proc

So, und da gibts halt immer n Fehlermeldung:
Zitat:
"Acces Violation at Adress ... etc.pp."

Ich kann mir ja schon denken, woran es liegt: Und zwar greift ja meine Proc. "initDBFelder" auf die DBFelder der ChildForm zu, die aber noch nicht fertig erstellt wurde.

Wie krieg ich das aber nu hin, das ich meine Procedure ausgelagert lassen kann, aber trotzdem automatisch beim Erstellen der ChildForm diese aufgerufen wird?

Leider gibts ja nicht so ne Methode wie z.B. "OnAfterCreate" oder "OnWennFertichMit" oder so...

vielen Dankl für eure Hilfe...

mfg


Zuletzt bearbeitet von kiwicht am Di 08.04.03 10:17, insgesamt 2-mal bearbeitet
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 08.04.03 09:53 
versuch doch ma onShow :shock:

dies procedure kommt nach der Oncreate ... ist mal so auf anhieb eingefallen :)

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
kiwicht Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Di 08.04.03 09:55 
hey das ging aber schnell! :shock:


hab ich schon... geht auch nicht, da muss es noch irgendein Ereigniss nach OnShow geben.... :(
GivDGivA
Hält's aus hier
Beiträge: 7



BeitragVerfasst: Di 08.04.03 10:01 
Vielleicht liegt es an der Reihenfolge der einzelnen Formulare.
Ändere mal unter Projekt->Optionen die Reihenfolge, so das die andere Unit zuerst erzeugt wird!

GivDGivA
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 08.04.03 10:01 
reihenfolge:

onCreate
OnShow
onPaint
OnActivate
OnResize

---Programm

oncloseQuerry
Onclose
Onhide
OnDestroy

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
kiwicht Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Di 08.04.03 10:02 
Hey, onResize klingt gut, das werd ich ma ausprobieren!

//EDIT

onResize klappt auch nicht, aber Paint funktioniert!
(kommt dann theoretisch in deiner Liste nach Resize, oder?)


jedenfalls vielen Dank für die Hilfe!!

mfg
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Di 08.04.03 12:32 
kiwicht hat folgendes geschrieben:
onResize klappt auch nicht, aber Paint funktioniert!
OnPaint ist aber gar nicht gut, denn OnPiant wird bei jedem neuzeichnen, sprich bei jedem verschieben des Fensters ausgeführt.
Das Ereignis, dass du suchst, heisst OnShow und dort sollte es auch gehen!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 08.04.03 12:38 
foxy hat folgendes geschrieben:
versuch doch ma onShow :shock:

kiwicht hat folgendes geschrieben:
hab ich schon... geht auch nicht, da muss es noch irgendein Ereigniss nach OnShow geben....


lesen :twisted:

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
kiwicht Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Di 08.04.03 13:04 
um zu vermeiden, das jedesmal beim Verschieben die Felder neu initiiert werden, dürfte folgendes helfen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
OnCreate: 
WorkDone := False;

OnPaint: 
if WorkDone := False then begin
initDBFelder;
WorkDone := True;
end;


vielen Dank nochmal euch beiden!

mfg
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Di 08.04.03 13:16 
kiwicht hat folgendes geschrieben:
um zu vermeiden, das jedesmal beim Verschieben die Felder neu initiiert werden, dürfte folgendes helfen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
OnCreate: 
WorkDone := False;

OnPaint: 
if WorkDone := False then begin
initDBFelder;
WorkDone := True;
end;


vielen Dank nochmal euch beiden!

mfg
Jo, das mag schon gehen, ist aber sehr unsauber. Normalerweise sollte das über OnShow laufen und es ist sehr verwunderlich, dass es so nicht bei dir geht...

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.