TabControl Programmierung
-
Hi zusammen,
ich besitze C++ Builder 5 und möchte mit TabControl programmieren. Ich habe die Tabs 1, 2 und 3 erstellt. Wie muss ich programmieren, dass z.B. Button1 angezeigt werden soll, falls Tab 1 ausgewählt wurde? Wenn ich also z.B. auf Tab 2 klicke, dann soll Button1 verschwinden. Mit meinem Code klappt es aber nicht. Hier ist mein bisheriger Code:
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::TabControl1Change(TObject *Sender) { if (TabControl1 -> Tabs == "1") {Button1 -> Visible = true;} if (TabControl1 -> Tabs == "2") {Button1 -> Visible = false;} if (TabControl1 -> Tabs == "3") {Button1 -> Visible = false;} } //---------------------------------------------------------------------------
Und hier sieht meine Oberfläche aus:
http://img819.imageshack.us/img819/4241/tabcontrol1.jpg
Für euer Hilfe wäre für mich dankbar
Viele liebe Grüße
Dominik
-
Nach dem was du geschieben hast wäre der Einsatz eines TPageControl besser.