Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;=> Author: Melba23
- #include <GUIConstantsEx.au3>
- #include <WindowsConstants.au3>
- #include <StaticConstants.au3>
- #include <GuiTab.au3>
- #include <WinAPI.au3>
- Opt("GUIResizeMode", $GUI_DOCKALL)
- $hGUI_Main = GUICreate("Test", 500, 500)
- $cButton_1 = GUICtrlCreateButton('Create Tab', 20, 450, 70, 20)
- $cButton_2 = GUICtrlCreateButton('Delete Tab', 120, 450, 70, 20)
- $cTab = GUICtrlCreateTab(0, 0, 500, 400, $TCS_MULTILINE)
- GUICtrlCreateTabItem('Tab_0')
- GUICtrlCreateTabItem('')
- GUISetState()
- $hGUI_Child = GUICreate("", 500, 400, 0, 0, $WS_POPUP, BitOr($WS_EX_MDICHILD, $WS_EX_LAYERED), $hGUI_Main)
- GUISetBkColor(0xABCDEF)
- _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0xABCDEF, 250)
- $cButton_3 = GUICtrlCreateButton('Test', 20, 30, 200, 20, $ss_sunken)
- $cInput = GUICtrlCreateInput('', 20, 60, 100, 20)
- GUISetState()
- GUISwitch($hGUI_Main)
- $iTabY = -1
- _CheckTab()
- $iCount = 0
- While 1
- Switch GUIGetMsg()
- Case $GUI_EVENT_CLOSE
- Exit
- Case $cButton_3
- ConsoleWrite('clicked button in tab item ' & GUICtrlRead($cTab) & @CRLF)
- Case $cButton_1
- $iCount += 1
- GUICtrlCreateTabItem('Tab_' & $iCount)
- GUICtrlCreateTabItem('')
- _CheckTab()
- Case $cButton_2
- GUICtrlDelete(GUICtrlRead($cTab, 1))
- _CheckTab()
- EndSwitch
- WEnd
- Func _CheckTab()
- $aTabRect = _GUICtrlTab_GetDisplayRect(GUICtrlGetHandle($cTab))
- If $aTabRect[1] <> $iTabY And $aTabRect[3] - $aTabRect[1] > 100 Then
- $tPoint = DllStructCreate("int X;int Y")
- DllStructSetData($tPoint, "X", $aTabRect[0])
- DllStructSetData($tPoint, "Y", $aTabRect[1])
- _WinAPI_ClientToScreen($hGUI_Main, $tPoint)
- $iX = DllStructGetData($tPoint, "X")
- $iY = DllStructGetData($tPoint, "Y")
- WinMove($hGUI_Child, "", $iX, $iY, $aTabRect[2] - $aTabRect[0], $aTabRect[3] - $aTabRect[1])
- $iTabY = $aTabRect[1]
- EndIf
- EndFunc
Add Comment
Please, Sign In to add comment