Autor Beitrag
cwille
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39

xp,win2003-server,linux
D7 Enterprise
BeitragVerfasst: Di 21.12.04 15:57 
Hallo und frohes Fest all denen die diesen Beitrag lesen,

ich habe ein Problem mit dem erneuten Aufruf eines MDI-Child-Formular aus einem MDI-Hauptformlar.
Nachdem diesen mit z.B TFrmAllAuszErf.Create(Self); gestartet wurde möchte ich dieses zu einem späteren Zeitpunkt erneut starten.


Mit FrmAnordnungMain.MDIChildren[FrmAllAuszErf.ComponentIndex].Show; funktioniert das leider da der ComponetIndex anscheinend nicht den richtigen Index ermittelt.

Weiss jemand eine Lösung für diesen Problem?

Danke und Gruß
Carsten
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Di 21.12.04 21:40 
FindComponent hilft dir vllt :roll:

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
cwille Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39

xp,win2003-server,linux
D7 Enterprise
BeitragVerfasst: Mi 22.12.04 09:37 
Hallo, habe ich ausprobiert, funktioniert leider nicht.

Es wird eine Exception erzeugt, mit der Meldung :Zugriffsverletzung an Adresse ....

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
 FormName: String;
Begin
FormName := 'FrmAnnErf';
(Application.FindComponent(FormName) as TFrmAnnErf).BringToFront;
End;


Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mi 22.12.04 09:49 
Titel: hmm,
ich benutze diese Function, sie vergleicht einfach den Header, setzt natürlich voraus dass die Header eindeutig sind.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
function TmdiMain.CheckWindowFromMain(sCaption:String;bVordergrund:Boolean):Boolean;
var bStatus:boolean;
    i:integer;
Begin
  bStatus:=TRUE;
  Begin
    for i := screen.Formcount - 1 downto 0 do
    if trim(screen.Forms[i].Caption) = trim(sCaption) then
    begin
      // ... dann hole es nach vorne
      if bVordergrund then
      Begin
        screen.Forms[i].BringToFront;
        screen.Forms[i].Repaint;
      end;
      bStatus:=FALSE;
    end;
  end;
  CheckWindowFromMain:=bStatus;
end;

_________________
mfg. Joel
cwille Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39

xp,win2003-server,linux
D7 Enterprise
BeitragVerfasst: Mi 22.12.04 10:19 
Hallo Joel,

besten Dank, hat funktioniert...

Gruß Carsten