| Autor |
Beitrag |
Xenon
      
Beiträge: 33
Win2000, XP
D6 Professionel
|
Verfasst: Di 27.05.03 12:48
Hallo zusammen ich versuche grad eine knifflige aufgabe zu lösen *gg*
Und zwar --> ich versuche 3 Panels die auf einem Panel sich befinden abwechslungsweise anzuzeigen ..
Ich habe einen Quellcode dazu geschrieben war gar nicht so einfach .. mit 2 Panels funktioniert es eigentlich tadellos
Hier ein beispiel -> www.cw-shop.com/niki/024_Panel.zip (das ihr in etwa versteht was ich meine)
ach ja was meine gleichungen betrifft ich weiss das ich Porbs mit der Boolschen Algebra=Mathematik habe  *gg*
Hier der code (sollten schluss endlich noch 2 splitter zwischen den Panels sein ..)
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266:
| procedure TForm1.FormCreate(Sender: TObject); begin P1.Visible := False; P2.Visible := False; P3.Visible := False; P4.Visible := False;
end;
procedure TForm1.Button1Click(Sender: TObject); begin begin if P3.Visible = True then begin P3.Align := alTop; P3.Height := 130; P1.Visible := True; P2.Visible := True; P2.Align := alClient; end else begin P1.Visible := True; P2.Visible := True; P2.Align := alClient; end;
begin if P4.Visible = True then begin P4.Align := alTop; P4.Height := 130; P1.Visible := True; P2.Visible := True; P2.Align := alClient; end else begin P1.Visible := True; P2.Visible := True; P2.Align := alClient; end;
If P3.Visible = True = P4.Visible = True then begin P3.Align := alClient; P3.Height := 130; P4.Align := alBottom; P4.Height := 130; P1.Visible := True; P2.Visible := True; P2.Align := alTop; end else begin P1.Visible := True; P2.Visible := True; P2.Align := alClient; end; end; end;
end;
procedure TForm1.Button2Click(Sender: TObject); begin begin if P2.Visible = True then begin P2.Align := alTop; P2.Height := 130; P1.Visible := True; P3.Visible := True; P3.Align := alClient; end else begin P1.Visible := True; P3.Visible := True; P3.Align := alClient; end;
begin if P4.Visible = True then begin P4.Align := alTop; P4.Height := 130; P1.Visible := True; P3.Visible := True; P3.Align := alClient; end else begin P1.Visible := True; P3.Visible := True; P3.Align := alClient; end;
If P2.Visible = True = P4.Visible = True then begin P2.Align := alTop; P2.Height := 130; P4.Align := alBottom; P4.Height := 130; P1.Visible := True; P3.Visible := True; P3.Align := alClient; end else begin P1.Visible := True; P3.Visible := True; P3.Align := alClient; end; end; end; end;
procedure TForm1.Button6Click(Sender: TObject); begin begin if P2.Visible = True then begin P2.Align := alTop; P2.Height := 100; P1.Visible := True; P4.Visible := True; P4.Align := alClient; end else begin P1.Visible := True; P4.Visible := True; P4.Align := alClient; end;
begin if P3.Visible = True then begin P3.Align := alBottom; P3.Height := 100; P1.Visible := True; P4.Visible := True; P4.Align := alClient; end else begin P1.Visible := True; P4.Visible := True; P4.Align := alClient; end;
If P3.Visible = True = P2.Visible = True then begin P3.Align := alClient; P3.Height := 130; P2.Align := alTop; P2.Height := 130; P1.Visible := True; P4.Visible := True; P4.Align := alBottom; end else begin P1.Visible := True; P4.Visible := True; P4.Align := alClient; end; end; end;
end; procedure TForm1.Button4Click(Sender: TObject); begin P2.Visible := False; P3.Align := alClient; P4.Align := alBottom; P1.Visible := True;
If P2.Visible = False then P3.Align := alClient; P1.Visible := True;
If P2.Visible = False then P4.Align := alClient; P1.Visible := True;
If P2.Visible = False = P3.Visible = False = P4.Visible = False then P1.Visible := False;
end;
procedure TForm1.Button3Click(Sender: TObject); begin P4.Visible := False; P2.Align := alTop; P2.Height := 130; P3.Align := alClient; P3.Height := 130; P1.Visible := True;
If P4.Visible = False then P2.Align := alClient; P1.Visible := True;
If P4.Visible = False then P3.Align := alClient; P1.Visible := True;
If P2.Visible = False = P3.Visible = False = P4.Visible = False then P1.Visible := False;
end;
procedure TForm1.Button5Click(Sender: TObject); begin P3.Visible := False; P2.Align := alTop; P2.Height := 130; P4.Align := alBottom; P4.Height := 130; P1.Visible := True;
if P3.Visible = False then P2.Align := alClient; P1.Visible := True;
If P3.Visible = False then P4.Align := alClient; P1.Visible := True;
If P2.Visible = False = P3.Visible = False = P4.Visible = False then P1.Visible := False; end;
end. |
Ich hoffe das des jetzt irgendwie verständlich war .. leider funzt es mit dem 3 Panels nicht ..
MFG Xen
|
|
ase
      
Beiträge: 203
Gentoo, Windows 9X, ME, 2k, NT, XP
Delphi 7 Prof., PHP 5 (Eclipse 3 SDK)
|
Verfasst: Di 27.05.03 21:10
servus
ist spät und muss ins bett also erklär ich nix weiter sondern poste einfach mal ne unit die ich eben gebastelt habe. sollte so gehen ist aber ohne splitter.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, Buttons;
type TForm1 = class(TForm) SpeedButton1: TSpeedButton; SpeedButton2: TSpeedButton; SpeedButton3: TSpeedButton; PanelRoot: TPanel; P1: TPanel; P2: TPanel; P3: TPanel; procedure FormCreate(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton2Click(Sender: TObject); procedure SpeedButton3Click(Sender: TObject); private Procedure UpdatePanels(Panel: TPanel); public end;
var Form1: TForm1;
implementation
{$R *.dfm}
Procedure TForm1.UpdatePanels(Panel: TPanel); Begin Panel.Visible := not Panel.Visible; PanelRoot.Visible := P1.Visible or P2.Visible or P3.Visible;
If P2.Visible or P3.Visible then P1.Align := alTop Else P1.Align := alClient;
P2.Align := alClient;
If P2.Visible and not P1.Visible then P3.Align := alBottom; If P2.Visible and P1.Visible then P3.Align := alBottom; If not P2.Visible then P3.Align := alClient;
If P1.Align = alTop then P1.Height := 100; If P3.Align = alBottom then P3.Height := 100; End;
procedure TForm1.FormCreate(Sender: TObject); begin PanelRoot.Visible := False; P1.Visible := False; P2.Visible := False; P3.Visible := False; end;
procedure TForm1.SpeedButton1Click(Sender: TObject); begin UpdatePanels(P1); end;
procedure TForm1.SpeedButton2Click(Sender: TObject); begin UpdatePanels(P2); end;
procedure TForm1.SpeedButton3Click(Sender: TObject); begin UpdatePanels(P3); end;
end. |
ase
Moderiert von Tino: Code- durch Delphi-Tag ersetzt.
_________________ -EN
|
|
Xenon 
      
Beiträge: 33
Win2000, XP
D6 Professionel
|
Verfasst: Mo 02.06.03 08:17
Titel: Splitter
Guten Morgen
Ich hab das so gelöst -->
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121:
| pocedure TForm1.Setze(Pan:Integer); Var Gross,TopPos,t:Integer; begin If NOT P1.Visible then P1.Visible := True; Case Pan of 2: begin P2.Visible := True; end; 3: begin P3.Visible := True; end; 4: begin P4.Visible := True; end; 5: begin SP1.Visible := True; end; 6: begin SP2.Visible := True; end; end; t:=0; If P2.Visible then Inc(t); If P3.Visible then Inc(t); If P4.Visible then Inc(t); If t = 0 then begin P1.Visible := False; Exit; end; Gross := P1.Height; TopPos:=0; Gross:=Gross DIV t; If P2.Visible then begin P2.Top := TopPos; P2.Height := Gross; TopPos := TopPos+Gross;
Sp1.Visible := True; end; If P3.Visible then begin P3.Top := TopPos; P3.Height := Gross; TopPos := TopPos+Gross;
Sp1.Visible := True; Sp2.Visible := True; end; If P4.Visible then begin P4.Top := TopPos; P4.Height := Gross; TopPos := TopPos+Gross;
Sp2.Visible := True; end;
If P1.Visible = P3.Visible = P2.Visible then begin SP1.Visible := True; end; If P1.Visible = P2.Visible = P3.Visible then begin SP1.Visible := True; end; If P1.Visible = P3.Visible = P4.Visible then begin SP2.Visible := True; end; If P1.Visible = P3.Visible = P3.Visible = P4.Visible then begin SP1.Visible := True; SP2.Visible := True; end;
End;
procedure TForm1.ToolButton1Click(Sender: TObject); begin P2.Visible := False; Setze(0); end;
procedure TForm1.ToolButton2Click(Sender: TObject); begin P3.Visible := False; Setze(0); end;
procedure TForm1.ToolButton3Click(Sender: TObject); begin P4.Visible:=False; Setze(0); end;
procedure TForm1.Button1Click(Sender: TObject); begin Setze(2); end;
procedure TForm1.Button2Click(Sender: TObject); begin Setze(3); end;
procedure TForm1.Button3Click(Sender: TObject); begin Setze(4); end;
procedure TForm1.FormCreate(Sender: TObject); begin P1.Visible := False; P2.Visible := False; P3.Visible := False; P4.Visible := False; SP1.Visible := False; SP2.Visible := False; end;
end |
Nun möchte ich auch noch mit den 2 Splitter arbeiten .. zwischen die Panels rein .. ich weiss aber nicht wie ich die einbinden könnte .. hast du eine Idee??
MFG XEN
|
|
ase
      
Beiträge: 203
Gentoo, Windows 9X, ME, 2k, NT, XP
Delphi 7 Prof., PHP 5 (Eclipse 3 SDK)
|
Verfasst: Mo 02.06.03 15:25
wo willst du die denn hin haben? zwischen jedes panel einen?
ase
_________________ -EN
|
|
Xenon 
      
Beiträge: 33
Win2000, XP
D6 Professionel
|
Verfasst: Di 03.06.03 08:04
Titel: Panel
Ja genau also in etwa so -->
[]l[]l[]
nur das ich des ganze von oben nach unten darstelle .. ich habs schon versucht aber des funktoniert noch net ganz ..
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164:
| // Case angabe zu den Panels Procedure TForm1.Setze(Pan:Integer); Var Gross,TopPos,t:Integer; begin If NOT P1.Visible then P1.Visible := True; Case Pan of 2: begin P2.Visible := True; end; 3: begin P3.Visible := True; end; 4: begin P4.Visible := True; end; 5: begin SP1.Visible := True; end; 6: begin SP2.Visible := True; end; end; t:=0;
If P2.Visible then Inc(t); If P3.Visible then Inc(t); If P4.Visible then Inc(t); if SP1.Visible then Inc(t); if SP2.Visible then Inc(t); if t = 0 then begin P1.Visible := False; Exit; end; Gross := P1.Height; TopPos:=0; Gross:=Gross DIV t; If P2.Visible then begin P2.Top := TopPos; P2.Height := Gross; TopPos := TopPos+Gross; end;
If P3.Visible then begin P3.Top := TopPos; P3.Height := Gross; TopPos := TopPos+Gross; end;
If P4.Visible then begin P4.Top := TopPos; P4.Height := Gross; TopPos := TopPos+Gross; end;
if P1.Visible = P2.Visible = P3.Visible = P4.Visible = Sp1.Visible = Sp2.Visible = True then begin P2.Align := alTop; SP1.Align := alTop; P3.Align := alClient; SP2.Align := alBottom; P4.Align := alBottom; SP1.Height := 9; SP2.Height := 9; end; End;
// Schliesst Panel2 procedure TForm1.ToolButton1Click(Sender: TObject); begin P2.Visible := False; SP1.Visible := False; Setze(0);
end;
// Schliesst Panel3 procedure TForm1.ToolButton2Click(Sender: TObject); begin P3.Visible := False; SP1.Visible := False; Setze(0); end;
// Schliesst Panel4 procedure TForm1.ToolButton3Click(Sender: TObject); begin P4.Visible :=False; Sp2.Visible := False; Setze(0); end;
// Öffnet Panel2 procedure TForm1.Button1Click(Sender: TObject); begin Setze(2); If P3.Visible = true then begin Setze(5); end; If P4.Visible = true then begin Setze(5); end; if P4.Visible = true then begin P4.Height := 200; P2.Align := alClient; P2.Align := alBottom; end; end;
// Öffnet Panel3 procedure TForm1.Button2Click(Sender: TObject); begin Setze(3); If P2.Visible = true then begin Setze(5); end; If P4.Visible = true then begin Setze(6); end; end;
// Öffnet Panel4 procedure TForm1.Button3Click(Sender: TObject); begin Setze(4); If P3.Visible = true then begin Setze(6); end; If P2.Visible = true then begin Setze(5); end; end;
// Beim Start des Programms sollen Panel 1,2,3 und 4 nicht sichtbar sein, // sie sollen zur Laufzeit erstellt werden. procedure TForm1.FormCreate(Sender: TObject); begin P1.Visible := False; P2.Visible := False; P3.Visible := False; P4.Visible := False; SP1.Visible := False; SP2.Visible := False; end;
end. |
TOP --> P2 -->
TOP --> SP1 -->
CLIENT --> P3 --> P1 (Container)
BOTTOM --> SP2 -->
BOTTOM --> P4 -->
so stell ich des ganze dar ..
Kannst du mir sagen was ich falsch mache??
MFG Nik
|
|
FriFra
      
Beiträge: 557
Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
|
Verfasst: Di 03.06.03 08:12
Ich verstehe nicht ganz, was gas ganze eigentlich soll  ...
 Warum verwendest Du nicht einfach ein PageControl, da sind alle Deine Probleme schon gelöst
 Man kann ja die Tabs und den 3D Rand deaktivieren, dann ist es im Prinzip das gleiche wie mit Deinen 3 Panels auf einem Panel nur mit vieel weniger Code.
_________________ Michael
(principal certified lotus professional - developer)
|
|
Xenon 
      
Beiträge: 33
Win2000, XP
D6 Professionel
|
Verfasst: Di 03.06.03 08:28
Titel: hoi
nein ich muss es so lösen !
MFG Nik
|
|
FriFra
      
Beiträge: 557
Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
|
Verfasst: Di 03.06.03 08:35
Titel: Re: hoi
| Xenon hat folgendes geschrieben: | nein ich muss es so lösen !
MFG Nik |
Und was spricht gegen die PageControl  ?
 Suchst Du die Herausforderung, oder hast Du zuviel Zeit?
_________________ Michael
(principal certified lotus professional - developer)
|
|
Xenon 
      
Beiträge: 33
Win2000, XP
D6 Professionel
|
Verfasst: Di 03.06.03 08:46
 also *gg*
dieser Container Panel ist schon auf einer PageControl .. zusammen mit einem DBStringGridPro .. ich muss ihn mit einem DropdownMenu aufrufen können
also -->
Aktion 31 ---> P2 auf alClient
Aktion 32 ---> P3 auf alClient
Aktion 33 ---> P4 auf alClient
wenn ich nun P3 und P4 anzeigen möchte .. sollte eine Splitter diese beiden Panels trennen .. verschieben usw.
Mit 2 Panels und einem Splitter fuktioniert das schon ganz toll
hat jemand eine Idee? *gg*
|
|
Xenon 
      
Beiträge: 33
Win2000, XP
D6 Professionel
|
Verfasst: Di 03.06.03 14:12
Niemand eine idee?? der code muss an fehler haben .. i komm einfach net drauf 
|
|
ase
      
Beiträge: 203
Gentoo, Windows 9X, ME, 2k, NT, XP
Delphi 7 Prof., PHP 5 (Eclipse 3 SDK)
|
Verfasst: Di 03.06.03 15:42
nu mal nich so ungedultig... =)
ich seh bei deinem code nich durch. is viel zu umständlich finde ich. aber gut. ich würde dir nen theoretischen ansatz liefern:
nach deinen prüfungen und nachdem alle panels dargestellt wurden solltest du folgendes machen:
wenn P1 und P2 da, dann SP1 darstellen (SP1.Visible := P1.Visible and P2.Visible)
wenn P2 und P3 da, dann SP2 darstellen (SP2.Visible := P2.Visible and P3.Visible)
wenn P1 und P3 da, dann SP3 darstellen (SP3.Visible := P1.Visible and P3.Visible)
so sollte des gehen. ich denke des müsste bei dir ans ende von Setze().
probiers mal.
ase
_________________ -EN
|
|
|