Declare nurso%, istab#[6], tabctrl1%, button1%, button2%, static1%, text1%, radiobutton1%, radiobutton2%, checkbox1%, checkbox2%
Declare checkbox3%, text2%, static2%, static3%, static4%
Def GetStockObject(1) !"GDI32","GetStockObject"
Def GetSysColor(1) !"USER32","GetSysColor"
Def GetParent(1) !"USER32","GetParent"
Def GetDlgCtrlID(1) !"USER32","GetDlgCtrlID"
Def &COLOR_BTNFACE $F
Def &DEFAULT_GUI_FONT $11
Def &WM_COMMAND $111
Struct is_tab = h$(40), t$(40), r%, p%
Dim istab#[], is_tab
Proc CreateElements
WindowStyle 26 | 512 | 2048
WindowTitle "Arbeitsfenster"
Window 280, 128 - 359, 375
Cls GetSysColor(&COLOR_BTNFACE)
SetDialogFont GetStockObject(&DEFAULT_GUI_FONT)
tabctrl1% = Create("TabCtrl", %hwnd, "tab1", 8, 8, 328, 320)
InsertTab(tabctrl1%, 1, "tab2")
static4% = Control("Static", "", $50000000, 8, 224, 312, 88, tabctrl1%, $4000, %hInstance, $1)
static3% = Control("Static", "", $50000000, 8, 128, 312, 88, tabctrl1%, $4001, %hInstance, $20000)
static2% = Control("Static", "", $50800000, 8, 32, 312, 88, tabctrl1%, $4002, %hInstance, 0)
static1% = Control("Static", "", $50000000, 8, 88, 312, 224, tabctrl1%, $4003, %hInstance, $20000)
text2% = Create("Text", static1%, "noch ein text", 8, 192, 168, 16)
checkbox3% = Create("CheckBox", static1%, "checkbox3", 8, 152, 150, 24)
checkbox2% = Create("CheckBox", static1%, "checkbox2", 8, 128, 150, 24)
checkbox1% = Create("CheckBox", static1%, "checkbox1", 8, 104, 150, 24)
radiobutton2% = Create("RadioButton", static1%, "radiobutton2", 8, 64, 150, 24)
radiobutton1% = Create("RadioButton", static1%, "radiobutton1", 8, 40, 150, 24)
text1% = Create("Text", static1%, "text", 8, 8, 32, 16)
button2% = Create("Button", tabctrl1%, "button2", 8, 56, 96, 24)
button1% = Create("Button", tabctrl1%, "button1", 8, 32, 96, 24)
EndProc
Proc CreateTabList
istab#[0].h$ = Str$(button1%) : istab#[0].t$ = Str$(tabctrl1%) : istab#[0].r% = 0 : istab#[0].p% = 0
istab#[1].h$ = Str$(button2%) : istab#[1].t$ = Str$(tabctrl1%) : istab#[1].r% = 0 : istab#[1].p% = 0
istab#[2].h$ = Str$(static1%) : istab#[2].t$ = Str$(tabctrl1%) : istab#[2].r% = 0 : istab#[2].p% = 0
istab#[3].h$ = Str$(static2%) : istab#[3].t$ = Str$(tabctrl1%) : istab#[3].r% = 1 : istab#[3].p% = 0
istab#[4].h$ = Str$(static3%) : istab#[4].t$ = Str$(tabctrl1%) : istab#[4].r% = 1 : istab#[4].p% = 0
istab#[5].h$ = Str$(static4%) : istab#[5].t$ = Str$(tabctrl1%) : istab#[5].r% = 1 : istab#[5].p% = 0
EndProc
Proc ExamineTabList
WhileLoop 0, SizeOf(istab#[]) - 2
If GetActiveTab(Val(istab#[&loop].t$)) = istab#[&loop].r%
If istab#[&loop].p% = 0
ShowWindow(Val(istab#[&loop].h$), 4)
Else
ShowWindow(GetParent(Val(istab#[&loop].h$)), 4)
EndIf
Else
If istab#[&loop].p% = 0
ShowWindow(Val(istab#[&loop].h$), 0)
Else
ShowWindow(GetParent(Val(istab#[&loop].h$)), 0)
EndIf
EndIf
EndWhile
EndProc
SubClassProc
Select %smessage
CaseOf $114, $115
SendMessage(%hwnd, %smessage, &swparam, &slparam)
CaseOf $101, $202, $205, $208
SendMessage(%hwnd, &WM_COMMAND, MakeLong(GetDlgCtrlID(&swnd), 0), &swnd)
EndSelect
Endproc
Proc MainLoop
UserMessages 16
ShowWindow(%hwnd, 1)
Subclass button1%, 1 : Subclass button2%, 1 : Subclass text1%, 1 : Subclass radiobutton1%, 1 : Subclass radiobutton2%, 1
Subclass checkbox1%, 1 : Subclass checkbox2%, 1 : Subclass checkbox3%, 1 : Subclass text2%, 1
While 1
WaitInput
Case %umessage = 16 : BREAK
If Clicked(tabctrl1%) '#window
ExamineTabList
ElseIf Clicked(button1%) 'tabctrl1% -> #window
ElseIf Clicked(button2%) 'tabctrl1% -> #window
ElseIf Clicked(text1%) 'static1% -> tabctrl1% -> #window
ElseIf Clicked(radiobutton1%) 'static1% -> tabctrl1% -> #window
ElseIf Clicked(radiobutton2%) 'static1% -> tabctrl1% -> #window
ElseIf Clicked(checkbox1%) 'static1% -> tabctrl1% -> #window
ElseIf Clicked(checkbox2%) 'static1% -> tabctrl1% -> #window
ElseIf Clicked(checkbox3%) 'static1% -> tabctrl1% -> #window
ElseIf Clicked(text2%) 'static1% -> tabctrl1% -> #window
EndIf
EndWhile
Subclass button1%, 0 : Subclass button2%, 0 : Subclass text1%, 0 : Subclass radiobutton1%, 0 : Subclass radiobutton2%, 0
Subclass checkbox1%, 0 : Subclass checkbox2%, 0 : Subclass checkbox3%, 0 : Subclass text2%, 0
EndProc
Proc Main
CreateElements
CreateTabList
ExamineTabList
MainLoop
EndProc
Main
Dispose istab#[]
End
Alles anzeigen