Autor Beitrag
rizor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Do 21.12.06 20:27 
Hallo,

ich arbeite gerade mit den Reitern und mir ist aufgefallen, dass das eine ungeheure Schreibarbeit ist.
ausblenden volle Höhe Delphi-Quelltext
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:
  if TCNaviBar.TabIndex=0 then    //Info
  begin
    LHead_01.Visible:=true;
    LHead_02.Visible:=true;
    LHead_03.Visible:=true;
    LHead_04.Visible:=true;
    IMain.Visible:=true;
    Lfunc.Visible:=false;
    Efunktion.Visible:=false;
    BBdelete.Visible:=false;
    BBuse.Visible:=false;
    Ldis.Visible:=false;
    Lfunktion.visible:=false;
    Lpot.visible:=false;
    Lbruch.Visible:=false;
    Lex.Visible:=false;
  end;

  if TCNaviBar.TabIndex=1 then    //Funktion eintragen
  begin
    LHead_01.Visible:=false;
    LHead_02.Visible:=false;
    LHead_03.Visible:=false;
    LHead_04.Visible:=false;
    IMain.Visible:=false;
    Lfunc.Visible:=true;
    Efunktion.Visible:=true;
    BBdelete.Visible:=true;
    BBuse.Visible:=true;
    Ldis.Visible:=true;
    Lfunktion.visible:=true;
    Lpot.visible:=true;
    Lbruch.Visible:=true;
    Lex.Visible:=true;
  end;

  if TCNaviBar.TabIndex=2 then    //Zeichen
  begin
    LHead_01.Visible:=false;
    LHead_02.Visible:=true;
    LHead_03.Visible:=false;
    LHead_04.Visible:=false;
    IMain.Visible:=false;
    Lfunc.Visible:=false;
    Efunktion.Visible:=false;
    BBdelete.Visible:=false;
    BBuse.Visible:=false;
    Ldis.Visible:=false;
    Lfunktion.visible:=false;
    Lpot.visible:=false;
    Lbruch.Visible:=false;
    Lex.Visible:=false;
  end;

  if TCNaviBar.TabIndex=3 then    //Ableiten
  begin
    LHead_01.Visible:=false;
    LHead_02.Visible:=false;
    LHead_03.Visible:=true;
    LHead_04.Visible:=false;
    IMain.Visible:=false;
    Lfunc.Visible:=false;
    Efunktion.Visible:=false;
    BBdelete.Visible:=false;
    BBuse.Visible:=false;
    Ldis.Visible:=false;
    Lfunktion.visible:=false;
    Lpot.visible:=false;
    Lbruch.Visible:=false;
    Lex.Visible:=false;
  end;

  if TCNaviBar.TabIndex=4 then    //NS,ES,WS,etc.
  begin
    LHead_01.Visible:=false;
    LHead_02.Visible:=false;
    LHead_03.Visible:=false;
    LHead_04.Visible:=true;
    IMain.Visible:=false;
    Lfunc.Visible:=false;
    Efunktion.Visible:=false;
    BBdelete.Visible:=false;
    BBuse.Visible:=false;
    Ldis.Visible:=false;
    Lfunktion.visible:=false;
    Lpot.visible:=false;
    Lbruch.Visible:=false;
    Lex.Visible:=false;
  end;

  if TCNaviBar.TabIndex=5 then    //Hilfe
  begin
    LHead_01.Visible:=false;
    LHead_02.Visible:=false;
    LHead_03.Visible:=false;
    LHead_04.Visible:=false;
    IMain.Visible:=true;
    Lfunc.Visible:=false;
    Efunktion.Visible:=false;
    BBdelete.Visible:=false;
    BBuse.Visible:=false;
    Ldis.Visible:=false;
    Lfunktion.visible:=false;
    Lpot.visible:=false;
    Lbruch.Visible:=false;
    Lex.Visible:=false;
  end;


Geht das auch einfacher?
Der Code wird ja auch unübersichtlich.

Danke.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 21.12.06 20:36 
Du könntest case-of benutzen. Vom welchem Typ sind denn die ganzen Dinger, von denen du visible änderst?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Fr 22.12.06 10:22 
das sind alles labels oder ähnliche teile
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Fr 22.12.06 10:34 
probiers mal mit
ausblenden Delphi-Quelltext
1:
2:
  LHead_01.Visible := TCNaviBar.TabIndex in [0]; // hier die gültigen Tabs eintragen
  LHead_02.Visible := TCNaviBar.TabIndex in [0]; // etc.

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
uwewo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 154



BeitragVerfasst: Fr 22.12.06 10:46 
Ok, Vielleicht so.

Setzte alle Labels etc. auf ein Panel und ändere die Propertys von diesem.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Fr 22.12.06 16:25 
Super. Das vereinfacht alles enorm.
Danke.