Autor Beitrag
Kaspar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Mo 26.12.05 15:50 
Hallo Zusammen,

Ich hoffe, dass meine Frage nicht all zu blöd ist.
Ist es möglich bei einem Frame die Quelle zu ändern?
Also so dass wenn ich auf einen Button klicke, Frame1 den Unit2 anstatt des Unit1 nutzt?
Wäre super wenn Ihr mir helfen könntet. :-)

Gruss Kaspar
Kaspar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Di 27.12.05 14:20 
Hallo,

Ich will ja nicht nerven, doch langsam bin ich am verzweifeln :-(
Also ich mochte nur links eine nav mit 5 Buttons, und dann rechts ein "bereich" oder halt eine Frame der sich bei jedem Buttonklick ändert. Also zb. Button1 lädt Frame1 - Button 2 -> Frame 2 etc.
Ist das möglich mit Frames? Oder giebts eine andere möglichkeit?
Danke im Voraus :-)

Gruss Kaspar
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Di 27.12.05 14:33 
Das ist sehr gut möglich mit Frames. Du legst einfach ein Panel dahin, wo der Frame zu sehen sein soll ( z.B. MyPanel ) und definierst in der Form eine private-Variable vom Typ TFrame, z.B.

ausblenden Delphi-Quelltext
1:
TmpFrame: TFrame					


Nun baust du für jeden der Buttons eine Ereignisbehandlung der Art:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure Form1.Button1Click( Sender: TObject );
begin
  if assigned( MyFrame ) then
    MyFrame.Free;
  MyFrame := TFrame1.Create( nil );
  MyFrame.Parent := MyPanel;
end;


So sollte es gehen.

_________________
Bravery calls my name in the sound of the wind in the night...
Grendel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 443

Gentoo Linux, MacOS X, Win 2000
D5 Ent, D7 Ent, Lazarus, Anjuta, MonoDevelop
BeitragVerfasst: Di 27.12.05 14:56 
user profile iconnoidic hat folgendes geschrieben:
Du legst einfach ein Panel dahin, wo der Frame zu sehen sein soll

Das Panel kannst Du dir aber auch schenken. d.h. Du kannst als Parent auch das Form direkt zuweisen.

Bis neulich ...
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Di 27.12.05 15:01 
sicher, aber es sollte ja anscheinend nur ein Teil des Formulars von dem Frame ausgefüllt werden.

_________________
Bravery calls my name in the sound of the wind in the night...
Grendel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 443

Gentoo Linux, MacOS X, Win 2000
D5 Ent, D7 Ent, Lazarus, Anjuta, MonoDevelop
BeitragVerfasst: Di 27.12.05 15:19 
user profile iconnoidic hat folgendes geschrieben:
sicher, aber es sollte ja anscheinend nur ein Teil des Formulars von dem Frame ausgefüllt werden.

Was bei korrekter Verwendung der Align Properties ja auch kein Problem ist.

Bis neulich ...
Kaspar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Di 27.12.05 15:43 
Vielen Dank für die Antworten.
Doch leider Pack ich das nicht :-(
Aaaaalso:
Ich habe 1 Form (Form1)
2 Buttons (Button1, Button2)
1 Panel (Panel1)

Nun gehe ich auf Datei->Neu->Frame und speichere das als Unit2.pas
Dasselbe nocheinmal mit Unit3.pas

Nun mache ich ein Onclick Event, auf beide Buttons.
Und was nun?
Bitte entschuldigt, ich bin leider noch ein Delphi Newbie, doch es wäre wirklich super, wenn Ihr mir trozdem weiterhelft :-)
Kaspar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Mi 28.12.05 17:55 
Hallo,

Bitte entschuldigt ich weiss, dass ich nerve :-( , doch könnt Ihr mir trozdem kurz helfen?
Wäre wirklich suuuper! :-D
Denn ich kriegs einfach nicht hin, und bin kurz vorm Verzweifeln :-(
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Mi 28.12.05 17:57 
Was in die OnClick-Events reinmuss hab ich doch bereits geschrieben, wo hakts denn da?

_________________
Bravery calls my name in the sound of the wind in the night...
Kaspar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Mi 28.12.05 18:03 
Naja, wie gebe ich denn die Quelle für den neuen Frame an?
Also dass der dann zb. Unit2 oder so nutzt?
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Do 29.12.05 09:01 
du bindest die benötigte Unit im Uses-Teil ein und im OnClick benutzt du dann die Frame-Klasse, die da deklariert ist, also z.B. TFrame2 oder wie auch immer die da heissen mag.

_________________
Bravery calls my name in the sound of the wind in the night...
Kaspar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Do 29.12.05 16:14 
Juhuuu

Es hat geklappt!
Viiiiieeeelen Dank, an alle!