Neue Version siehe Post#1
Jetzt kann man auch Icons anzeigen lassen. Das war ziemlich viel Arbeit, aber es hat sich gelohnt. Sieht meiner Meinung nach toll aus.
Neue Version siehe Post#1
Jetzt kann man auch Icons anzeigen lassen. Das war ziemlich viel Arbeit, aber es hat sich gelohnt. Sieht meiner Meinung nach toll aus.
Meinst du das so?
#include "OwnTab.au3"
[/autoit] [autoit][/autoit] [autoit]GUICreate("Funkey's OwnTab-UDF Example 2", 500, 345)
GUISetBkColor(0xbbbbbb)
Local $aTabText[4] = ["Item 1", "Much More Longer Item 2", "Pic", "Status"] ;Declare the regions for the OwnTab-control
Global $aCtrlTab = _OwnTabCreate($aTabText, 10, 10, 480, 300, 25, 0xD5D5D5, 0xCFE0E7, 0xCFE0E7)
Local $aTabTip[4] = ["Tip Item 1", "Tip Item 2", "Tip Item 3", "Tip Item 4"]
_OwnTabSetTip($aCtrlTab, $aTabTip) ;set the tooltips for the OwnTab-control
#Region Tab1
_OwnTabAdd($aCtrlTab) ;Start controls tab1
Global $Edit1 = GUICtrlCreateEdit("Edit in Tab1", 20, 50, 300, 50, 0)
Global $Button1 = GUICtrlCreateButton("Simulate an alarm", 20, 120, 300, 20)
#EndRegion Tab1
#Region Tab2
_OwnTabAdd($aCtrlTab) ;Start controls tab2
Global $Edit2 = GUICtrlCreateEdit("Edit in Tab2", 20, 150, 300, 50, 0)
Global $Label2 = GUICtrlCreateLabel("Label in Tab2", 20, 220, 300, 20, 0x201)
GUICtrlSetBkColor(-1, -2) ;$GUI_BKCOLOR_TRANSPARENT
#EndRegion Tab2
#Region Tab3
_OwnTabAdd($aCtrlTab) ;Start controls tab3
Global $Edit3 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 20, 45, 460, 280)
#EndRegion Tab3
#Region Tab4
_OwnTabAdd($aCtrlTab) ;Start controls tab4
Global $Button4 = GUICtrlCreateButton("Acknowledge the alarm", 20, 120, 300, 20)
#EndRegion Tab4
_OwnTabEnd($aCtrlTab) ;End OwnTab
_OwnTabSwitch($aCtrlTab, 1) ;inizialize the OwnTab
GUISetState()
_OwnTabHover($aCtrlTab, 0xFFFF88) ;start hover-function if you want
Local $msg
Do
$msg = GUIGetMsg()
For $a = 1 To UBound($aCtrlTab, 1) - 1
If $msg = $aCtrlTab[$a][0] Then
_OwnTabSwitch($aCtrlTab, $a)
_Function($a)
EndIf
Next
If $msg = $Button1 Then _OwnTabSetAlarm($aCtrlTab, 4, 0xFF0000, 0xFF0000)
If $msg = $Button4 Then _OwnTabReSetAlarm($aCtrlTab, 4)
Sleep(10)
Until $msg = -3
Func _Function($iIndex)
MsgBox(0, "OwnTab-Control", "Es wurde Register " & $iIndex & " ausgewählt.")
EndFunc ;==>_Function
Das kannst du doch machen wie du gerade lustig bist. ![]()
Du kannst einfach
[autoit]SplashImageOn
SplashTextOn
dafür verwenden.
Außerdem schaltet
[autoit]_WinAPI_MsgBox
[/autoit]immer den BlockInput aus ![]()
Danke Simon für das Lob! Aber wie meinst du das mit einer Hintergrundfunktion für die einzelnen Tabs?
Hab noch einen Fehler bei der Hover-Funktion ausgebessert, siehe Post#1.
$sIP = "10.0.0.130"
$sSub = "255.255.255.0"
$sGW = "10.0.0.138"
$sConnection = "Drahtlose Netzwerkverbindung"
RunWait(@ComSpec & " /c netsh interface ip set address " & Chr(34) & $sConnection & Chr(34) & " static " & $sIP & " " & $sSub & " " & $sGW & " 0", "", @SW_HIDE)
[/autoit]mfg funkey
Funktioniert doch!
Hier noch mal in einer Funktion:
ConsoleWrite(_RegexMatches('\d+', 'ABC123DEF') & @CRLF)
[/autoit] [autoit][/autoit] [autoit]Func _RegexMatches($sPattern, $sString)
Local $sCode = 'Function RegexMatches(sPattern, sString)' & _
@LF & ' Dim oRegEx, oMatch, oMatches, RetStr' & _ ; Create variables.
@LF & ' Set oRegEx = New RegExp' & _ ; Create regular expression.
@LF & ' oRegEx.Pattern = sPattern' & _ ; Set pattern.
@LF & ' oRegEx.IgnoreCase = True' & _ ; Set case sensitivity.
@LF & ' oRegEx.Global = True' & _ ; Set Global option.
@LF & ' Set oMatches = oRegEx.Execute(sString)' & _ ; Execute the search test.
@LF & ' For Each oMatch in oMatches' & _
@LF & ' RetStr = RetStr & "Match found at position "' & _
@LF & ' RetStr = RetStr & oMatch.FirstIndex & vbCRLF' & _
@LF & ' RetStr = RetStr & "Match Value is "' & _
@LF & ' RetStr = RetStr & oMatch.Value & "." & vbCRLF & vbCRLF' & _
@LF & ' Next' & _
@LF & ' RegexMatches = RetStr' & _
@LF & 'End Function' & @LF
Local $Vbs = ObjCreate('ScriptControl')
$Vbs.Language = 'VBScript'
$Vbs.AddCode($sCode)
$sRET = $Vbs.Run('RegexMatches', $sPattern, $sString)
Return $sRet
EndFunc
Du hattest doch schon so einen Thread
[ offen ] GUI Mit Schwerkraft
Damit meinst du WinFlash, oder?
[autoit]WinFlash
_WinAPI_FlashWindow
_WinAPI_FlashWindowEx
Welches Fenster sollte sich im Hintergrund öffnen? Sorry aber ich hab's immer noch nicht ganz verstanden!
Wenn also z.B. ein Alarm eines Registers auftritt und das Fenster mit dem OwnTab im Hintergrund ist, dass dann WinFlash aufgerufen wird?
Klingt eher zeitintensiv, aber auf jeden Fall sehr interessant. Weiß noch nicht ob ich Zeit finde, aber es würde mich schon reizen.
AutoBert, auch von mir alles Gute zum Geburtstag und gute Besserung!!
[Blockierte Grafik: http://smilie-land.de/t/i-l/krank/krank0027.gif][Blockierte Grafik: http://smilie-land.de/t/e-h/geburtstag/geb0006.gif]
Danke DeepRed92!
Hab die UDF jetzt um die Hover-Funktion erweitert.
Download siehe Post#1
Funktioniert bei mir zwar nicht, sollte aber so ähnlich gehen. ![]()
Run('"control.exe "'& @SystemDir & '\irprops.cpl, BluetoothAuthenticationAgent"')
[/autoit]Thx Raupi!
Nächste Version! Jetzt kann die Farbe der einzelnen Register geändert werden, z.B. wenn ein Alarm auftritt ![]()
#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]GUICreate("Funkey's Own Tabs ;)", 500, 345)
GUISetBkColor(0xbbbbbb)
Local $aTabText[4] = ["Item 1", "Much More Longer Item 2", "Pic", "Status"] ;Declare the regions for the OwnTab-control
Global $aCtrlTab = _OwnTabCreate($aTabText, 10, 10, 480, 300, 25, 0xD5D5D5, 0xCFE0E7, 0xCFE0E7)
#Region Tab1
$aCtrlTab[0][4] = GUICtrlCreateDummy() ;Start controls tab1
Global $Edit1 = GUICtrlCreateEdit("Edit in Tab1", 20, 50, 300, 50, 0)
Global $Button1 = GUICtrlCreateButton("Simulate an alarm", 20, 120, 300, 20)
#EndRegion Tab1
#Region Tab2
$aCtrlTab[1][4] = GUICtrlCreateDummy() ;Start controls tab2
Global $Edit2 = GUICtrlCreateEdit("Edit in Tab2", 20, 150, 300, 50, 0)
Global $Label2 = GUICtrlCreateLabel("Label in Tab2", 20, 220, 300, 20, 0x201)
GUICtrlSetBkColor(-1, -2) ;$GUI_BKCOLOR_TRANSPARENT
#EndRegion Tab2
#Region Tab3
$aCtrlTab[2][4] = GUICtrlCreateDummy() ;Start controls tab3
Global $Edit3 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 20, 45, 460, 280)
#EndRegion Tab3
#Region Tab4
$aCtrlTab[3][4] = GUICtrlCreateDummy() ;Start controls tab4
Global $Button4 = GUICtrlCreateButton("Acknowledge the alarm", 20, 120, 300, 20)
#EndRegion Tab4
$aCtrlTab[4][4] = GUICtrlCreateDummy() ;End OwnTab
[/autoit] [autoit][/autoit] [autoit]_OwnTabSwitch($aCtrlTab, 1)
GUISetState()
Local $msg
Do
$msg = GUIGetMsg()
For $a = 1 To UBound($aCtrlTab, 1) - 1
If $msg = $aCtrlTab[$a][0] Then _OwnTabSwitch($aCtrlTab, $a)
Next
If $msg = $Button1 Then _OwnTabSetCol($aCtrlTab, 4, 0xFF0000, 0xFF0000)
If $msg = $Button4 Then _OwnTabSetCol($aCtrlTab, 4)
Sleep(10)
Until $msg = -3
Func _OwnTabCreate($aTabText, $xPos, $yPos, $iWidth, $iHeight, $iItemHeight = -1, $nColNoSel = -1, $nColSel = -1, $nColBg = -1)
Local $aSize, $aSize2[UBound($aTabText)][2], $xLast = 0, $aCtrl[UBound($aTabText) + 1][5]
If Not IsArray($aTabText) Then Return SetError(1, 0, "")
$aCtrl[0][2] = $nColNoSel
$aCtrl[0][3] = $nColSel
For $i = 0 To UBound($aTabText) - 1
If $aTabText[$i] = "" Then Return SetError(2, $i + 1, "")
$aSize = _GetTextSize($aTabText[$i])
$aSize[0] += Ceiling($aSize[0] / 10) ;make it 10% longer for bold text
$aSize2[$i][0] = $aSize[0]
$aSize2[$i][1] = $aSize[1]
If $iItemHeight = -1 Then $iItemHeight = $aSize[1]
$aCtrl[$i + 1][0] = GUICtrlCreateLabel($aTabText[$i], $xPos + $xLast + 5, $yPos + 2, $aSize[0] + 5, $iItemHeight, 0x411201)
$aCtrl[$i + 1][2] = $nColNoSel
$aCtrl[$i + 1][3] = $nColSel
$xLast += $aSize[0] + 5
Next
GUICtrlCreateLabel("", $xPos, $yPos + $iItemHeight, $iWidth, $iHeight, 0x411000)
GUICtrlSetState(-1, 128) ;$GUI_DISABLE
GUICtrlSetBkColor(-1, $nColBg)
$xLast = 0
For $i = 0 To UBound($aTabText) - 1
$aCtrl[$i + 1][1] = GUICtrlCreateLabel("", $xPos + $xLast + 6, $yPos + $iItemHeight, $aSize2[$i][0] + 3, 2)
GUICtrlSetBkColor(-1, $nColSel)
$xLast += $aSize2[$i][0] + 5
Next
Return $aCtrl
EndFunc ;==>_OwnTabCreate
Func _OwnTabSwitch(ByRef $aOwnTab, $iIndex)
If $aOwnTab[0][0] = $iIndex Then Return
For $s = 1 To UBound($aOwnTab, 1) - 1
If $iIndex <> $s Then
GUICtrlSetState($aOwnTab[$s][1], 32) ;$GUI_HIDE
GUICtrlSetBkColor($aOwnTab[$s][0], $aOwnTab[$s][2])
GUICtrlSetFont($aOwnTab[$s][0], -1, 400)
Else
GUICtrlSetBkColor($aOwnTab[$iIndex][0], $aOwnTab[$s][3])
GUICtrlSetFont($aOwnTab[$iIndex][0], -1, 1000)
GUICtrlSetState($aOwnTab[$iIndex][1], 16) ;$GUI_SHOW
EndIf
Next
For $t = $aOwnTab[0][4] To $aOwnTab[UBound($aOwnTab, 1) - 1][4]
GUICtrlSetState($t, 32) ;$GUI_HIDE
If $t > $aOwnTab[$iIndex - 1][4] And $t < $aOwnTab[$iIndex][4] Then GUICtrlSetState($t, 16) ;$GUI_SHOW
Next
$aOwnTab[0][0] = $iIndex
EndFunc ;==>_OwnTabSwitch
Func _OwnTabSetCol(ByRef $aOwnTab, $iIndex, $nColNoSel = -1, $nColSel = -1)
If $nColNoSel = -1 Then
$aOwnTab[$iIndex][2] = $aOwnTab[0][2]
Else
$aOwnTab[$iIndex][2] = $nColNoSel
EndIf
If $nColNoSel = -1 Then
$aOwnTab[$iIndex][3] = $aOwnTab[0][3]
Else
$aOwnTab[$iIndex][3] = $nColSel
EndIf
If $aOwnTab[0][0] <> $iIndex Then
GUICtrlSetBkColor($aOwnTab[$iIndex][0], $aOwnTab[$iIndex][2])
Else
GUICtrlSetBkColor($aOwnTab[$iIndex][0], $aOwnTab[$iIndex][3])
EndIf
GUICtrlSetBkColor($aOwnTab[$iIndex][1], $aOwnTab[$iIndex][3])
EndFunc
Func _GetTextSize($nText, $sFont = 'Microsoft Sans Serif', $iFontSize = 8.5, $iFontAttributes = 0)
;Author: Bugfix
;Modified: funkey
If $nText = '' Then Return
Local $hGui = GUICreate("Textmeter by Bugfix")
_GDIPlus_Startup()
Local $hFormat = _GDIPlus_StringFormatCreate(0)
Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, $iFontAttributes, 3)
Local $tLayout = _GDIPlus_RectFCreate(15, 171, 0, 0)
Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
Local $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
Local $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGui)
Local $aSize[2] = [$iWidth, $iHeight]
Return $aSize
EndFunc ;==>_GetTextSize
Alles Gute auch von mir!!
Ich dachte du warst mal so ca. 10 Jahre jünger
Wird mich wohl getäuscht haben. ![]()
Zitat von tobi_girstGraphisch: 4-5
Ich hoffe das liegt hauptsächlich nur an den Farben, die ich für die Beispiele verwendet habe. ![]()
Danke für die ansonsten positiven Kommentare!
Hab das Skript noch ein bischen weiter verbessert.
Der Text des aktiven Registers wird nun fett angezeigt.
#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]GUICreate("Funkey's Own Tabs ;)", 500, 345)
GUISetBkColor(0xbbbbbb)
Local $aTabText[4] = ["Item 1", "Much More Longer Item 2", "Pic", "Empty"] ;Declare the regions for the OwnTab-control
Global $aCtrlTab = _OwnTabCreate($aTabText, 10, 10, 480, 300, 25, 0xD5D5D5, 0xCFE0E7, 0xCFE0E7)
#Region Tab1
$aCtrlTab[0][4] = GUICtrlCreateDummy() ;Start controls tab1
Global $Edit1 = GUICtrlCreateEdit("Edit in Tab1", 20, 50, 300, 50, 0)
Global $Label1 = GUICtrlCreateButton("Button in Tab1", 20, 120, 300, 20)
#EndRegion Tab1
#Region Tab2
$aCtrlTab[1][4] = GUICtrlCreateDummy() ;Start controls tab2
Global $Edit2 = GUICtrlCreateEdit("Edit in Tab2", 20, 150, 300, 50, 0)
Global $Label2 = GUICtrlCreateLabel("Label in Tab2", 20, 220, 300, 20, 0x201)
GUICtrlSetBkColor(-1, -2) ;$GUI_BKCOLOR_TRANSPARENT
#EndRegion Tab2
#Region Tab3
$aCtrlTab[2][4] = GUICtrlCreateDummy() ;Start controls tab3
Global $Edit3 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 20, 45, 460, 280)
#EndRegion Tab3
$aCtrlTab[3][4] = GUICtrlCreateDummy() ;Empty tab
$aCtrlTab[4][4] = GUICtrlCreateDummy() ;End own tabs
_OwnTabSwitch($aCtrlTab, 1)
[/autoit] [autoit][/autoit] [autoit]GUISetState()
[/autoit] [autoit][/autoit] [autoit]Local $msg
Do
$msg = GUIGetMsg()
For $a = 1 To UBound($aCtrlTab, 1) - 1
If $msg = $aCtrlTab[$a][0] Then _OwnTabSwitch($aCtrlTab, $a)
Next
Sleep(10)
Until $msg = -3
Func _OwnTabCreate($aTabText, $xPos, $yPos, $iWidth, $iHeight, $iItemHeight = -1, $nColNoSel = -1, $nColSel = -1, $nColBg = -1)
Local $aSize, $aSize2[UBound($aTabText)][2], $xLast = 0, $aCtrl[UBound($aTabText) + 1][5]
If Not IsArray($aTabText) Then Return SetError(1, 0, "")
For $i = 0 To UBound($aTabText) - 1
If $aTabText[$i] = "" Then Return SetError(2, $i + 1, "")
$aSize = _GetTextSize($aTabText[$i])
$aSize[0] += Ceiling($aSize[0] / 10) ;make it 10% longer for bold text
$aSize2[$i][0] = $aSize[0]
$aSize2[$i][1] = $aSize[1]
If $iItemHeight = -1 Then $iItemHeight = $aSize[1]
$aCtrl[$i + 1][0] = GUICtrlCreateLabel($aTabText[$i], $xPos + $xLast + 5, $yPos + 2, $aSize[0] + 5, $iItemHeight, 0x411201)
$aCtrl[$i + 1][2] = $nColNoSel
$aCtrl[$i + 1][3] = $nColSel
$xLast += $aSize[0] + 5
Next
GUICtrlCreateLabel("", $xPos, $yPos + $iItemHeight, $iWidth, $iHeight, 0x411000)
GUICtrlSetState(-1, 128) ;$GUI_DISABLE
GUICtrlSetBkColor(-1, $nColBg)
$xLast = 0
For $i = 0 To UBound($aTabText) - 1
$aCtrl[$i + 1][1] = GUICtrlCreateLabel("", $xPos + $xLast + 6, $yPos + $iItemHeight, $aSize2[$i][0] + 3, 2)
GUICtrlSetBkColor(-1, $nColSel)
$xLast += $aSize2[$i][0] + 5
Next
Return $aCtrl
EndFunc ;==>_OwnTabCreate
Func _OwnTabSwitch($aOwnTab, $iIndex)
Local $iSwitch = $iIndex
For $s = 1 To UBound($aOwnTab, 1) - 1
If $iIndex <> $s Then
GUICtrlSetState($aOwnTab[$s][1], 32) ;$GUI_HIDE
GUICtrlSetBkColor($aOwnTab[$s][0], $aOwnTab[$s][2])
GUICtrlSetFont($aOwnTab[$s][0], -1, 400)
Else
GUICtrlSetBkColor($aOwnTab[$iIndex][0], $aOwnTab[$s][3])
GUICtrlSetFont($aOwnTab[$iIndex][0], -1, 1000)
GUICtrlSetState($aOwnTab[$iIndex][1], 16) ;$GUI_SHOW
EndIf
Next
For $t = $aOwnTab[0][4] To $aOwnTab[UBound($aOwnTab, 1) - 1][4]
GUICtrlSetState($t, 32) ;$GUI_HIDE
If $t > $aOwnTab[$iIndex - 1][4] And $t < $aOwnTab[$iIndex][4] Then GUICtrlSetState($t, 16) ;$GUI_SHOW
Next
EndFunc ;==>_OwnTabSwitch
Func _GetTextSize($nText, $sFont = 'Microsoft Sans Serif', $iFontSize = 8.5, $iFontAttributes = 0)
;Author: Bugfix
;Modified: funkey
If $nText = '' Then Return
Local $hGui = GUICreate("Textmeter by Bugfix")
_GDIPlus_Startup()
Local $hFormat = _GDIPlus_StringFormatCreate(0)
Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, $iFontAttributes, 3)
Local $tLayout = _GDIPlus_RectFCreate(15, 171, 0, 0)
Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
Local $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
Local $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGui)
Local $aSize[2] = [$iWidth, $iHeight]
Return $aSize
EndFunc ;==>_GetTextSize
Geht das auch?
[autoit]$Text = "Moin!!!Zeile 1" & @CRLF & "Wie gehts?"
$Text = StringTrimLeft($Text, StringInStr($Text, "!!!") + 2)
MsgBox(0, "", $Text)
Edit: Oder so?
[autoit]$Text = "Moin!!!Zeile 1" & @CRLF & "Wie gehts?"
$Text = StringRegExpReplace($Text, ".+!!!", "")
MsgBox(0, "", $Text)
Neue Version ![]()
Grafisch etwas verbessert und außerdem sind nun mehrere Tabs möglich.
#Include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]GUICreate("Funkey's Own Tabs ;)", 500, 700)
Local $aTabText[4] = ["Item 1", "Longer Item 2", "3rd Item", "Tab in Tab"] ;Declare the regions for the OwnTab-control
Global $aCtrlTab = _OwnTabCreate($aTabText, 10, 10, 480, 300, 25, -1, 0x00FF00, 0x00FF00)
[/autoit] [autoit][/autoit] [autoit]#Region Tab1
$aCtrlTab[0][4] = GUICtrlCreateDummy() ;Start controls tab1
Global $Edit1 = GUICtrlCreateEdit("Edit in Tab1", 20, 50, 300, 50)
Global $Label1 = GUICtrlCreateLabel("Label in Tab1", 20, 100, 300, 20)
#EndRegion
#Region Tab2
$aCtrlTab[1][4] = GUICtrlCreateDummy() ;Start controls tab2
Global $Edit2 = GUICtrlCreateEdit("Edit in Tab2", 20, 150, 300, 50)
Global $Label2 = GUICtrlCreateLabel("Label in Tab2", 20, 200, 300, 20)
#EndRegion
#Region Tab3
$aCtrlTab[2][4] = GUICtrlCreateDummy() ;Start controls tab3
Global $Edit3 = GUICtrlCreateEdit("Edit in Tab3", 20, 250, 300, 50)
Global $Label3 = GUICtrlCreateLabel("Label in Tab3", 20, 300, 300, 20)
#EndRegion
#Region Tab4
$aCtrlTab[3][4] = GUICtrlCreateDummy() ;Start controls tab4
Local $aTabText[2] = ["Test 1", "Test 2"] ;Declare the regions for the OwnTab-control
Global $aCtrlTab2 = _OwnTabCreate($aTabText, 50, 50, 280, 100, 25, 0xFF0000, 0xFFFF00, 0xFFFF00)
#Region Tab1 in Tab4
$aCtrlTab2[0][4] = GUICtrlCreateDummy() ;Start controls tab1
Global $Edit41 = GUICtrlCreateEdit("Edit in Tab1 in Tab4", 70, 100, 200, 70)
#EndRegion
#Region Tab2 in Tab4
$aCtrlTab2[1][4] = GUICtrlCreateDummy() ;Start controls tab1
Global $Button42 = GUICtrlCreateButton("A Button in a tab in a tab", 70, 100, 200, 30)
#EndRegion
$aCtrlTab2[2][4] = GUICtrlCreateDummy() ;End controls for tab in tab
$aCtrlTab[4][4] = GUICtrlCreateDummy() ;End controls for tab
GUICtrlCreateLabel("Label unterhalb des OwnTab", 20, 350, 300, 20)
[/autoit] [autoit][/autoit] [autoit]Local $aTabText[2] = ["Buttons Page 1", "Buttons Page 2"] ;Declare the regions for the OwnTab-control
Global $aCtrlTab3 = _OwnTabCreate($aTabText, 10, 400, 400, 250, 20, 0xaaaaaa, 0xffff, 0xffff)
#Region Tab1
$aCtrlTab3[0][4] = GUICtrlCreateDummy() ;Start controls tab1
Global $Button11 = GUICtrlCreateButton("Button1", 20, 440, 80, 30)
Global $Button12 = GUICtrlCreateButton("Button2", 20, 480, 80, 30)
Global $Button13 = GUICtrlCreateButton("Button3", 20, 520, 80, 30)
Global $Button14 = GUICtrlCreateButton("Button4", 20, 560, 80, 30)
Global $Button15 = GUICtrlCreateButton("Button5", 20, 600, 80, 30)
#EndRegion
#Region Tab2
$aCtrlTab3[1][4] = GUICtrlCreateDummy() ;Start controls tab2
Global $Button21 = GUICtrlCreateButton("Button6", 20, 440, 80, 30)
Global $Button22 = GUICtrlCreateButton("Button7", 20, 480, 80, 30)
Global $Button23 = GUICtrlCreateButton("Button8", 20, 520, 80, 30)
Global $Button24 = GUICtrlCreateButton("Button9", 20, 560, 80, 30)
Global $Button25 = GUICtrlCreateButton("Button10", 20, 600, 80, 30)
#EndRegion
$aCtrlTab3[2][4] = GUICtrlCreateDummy() ;End controls for tab in tab
[/autoit] [autoit][/autoit] [autoit]Global $MemTabInTab1 = 4 ; This variable shows where the tab in tab is.
Global $MemTabInTab2 = 1 ; Variable to remember what register in the tab in tab was selected
_OwnTabSwitch($aCtrlTab3, 1) ; show first tab-register in tab in tab
_OwnTabSwitch($aCtrlTab2, $MemTabInTab2) ; show first tab-register in tab in tab
_OwnTabSwitch($aCtrlTab, 1) ; show first tab-register
GUISetState()
[/autoit] [autoit][/autoit] [autoit]Local $msg
Do
$msg = GUIGetMsg()
For $a = 1 To UBound($aCtrlTab, 1) - 1
If $msg = $aCtrlTab[$a][0] Then
_OwnTabSwitch($aCtrlTab, $a)
If $a = $MemTabInTab1 Then _OwnTabSwitch($aCtrlTab2, $MemTabInTab2)
EndIf
Next
For $a = 1 To UBound($aCtrlTab2, 1) - 1
If $msg = $aCtrlTab2[$a][0] Then
_OwnTabSwitch($aCtrlTab2, $a)
$MemTabInTab2 = $a ;remember the selected register
EndIf
Next
For $a = 1 To UBound($aCtrlTab3, 1) - 1
If $msg = $aCtrlTab3[$a][0] Then _OwnTabSwitch($aCtrlTab3, $a)
Next
Sleep(10)
Until $msg = -3
Func _OwnTabCreate($aTabText, $xPos, $yPos, $iWidth, $iHeight, $iItemHeight = -1, $nColNoSel = -1, $nColSel = -1, $nColBg = -1)
Local $aSize, $xLast = 0, $aCtrl[UBound($aTabText) + 1][5]
If Not IsArray($aTabText) Then Return SetError(1, 0, "")
GUICtrlCreateLabel("", $xPos, $yPos + $iItemHeight, $iWidth, $iHeight, 0x1000)
GUICtrlSetState(-1, 128) ;$GUI_DISABLE
GUICtrlSetBkColor(-1, $nColBg)
For $i = 0 To UBound($aTabText) -1
If $aTabText[$i] = "" Then Return SetError(2, $i+1, "")
$aSize = _GetTextSize($aTabText[$i])
If $iItemHeight = -1 Then $iItemHeight = $aSize[1]
$aCtrl[$i+1][0] = GUICtrlCreateLabel($aTabText[$i], $xPos + $xLast + 2, $yPos + 2, $aSize[0] + 5, $iItemHeight, BitOR(0x201, 0x411000))
$aCtrl[$i+1][1] = GUICtrlCreateLabel("", $xPos + $xLast + 4, $yPos + $iItemHeight, $aSize[0] + 1, 2)
GUICtrlSetBkColor(-1, $nColSel)
$aCtrl[$i+1][2] = $nColNoSel
$aCtrl[$i+1][3] = $nColSel
$xLast += $aSize[0] + 5
Next
Return $aCtrl
EndFunc
Func _OwnTabSwitch($aOwnTab, $iIndex)
Local $iSwitch = $iIndex
For $s = 1 To UBound($aOwnTab, 1) - 1
If $iIndex <> $s Then
GUICtrlSetState($aOwnTab[$s][1], 32) ;$GUI_HIDE
GUICtrlSetBkColor($aOwnTab[$s][0], $aOwnTab[$s][2])
Else
GUICtrlSetBkColor($aOwnTab[$iIndex][0], $aOwnTab[$s][3])
GUICtrlSetState($aOwnTab[$iIndex][1], 16) ;$GUI_SHOW
EndIf
Next
For $t = $aOwnTab[0][4] To $aOwnTab[UBound($aOwnTab, 1)-1][4]
GUICtrlSetState($t, 32) ;$GUI_HIDE
If $t > $aOwnTab[$iIndex-1][4] And $t < $aOwnTab[$iIndex][4] Then GUICtrlSetState($t, 16) ;$GUI_SHOW
Next
EndFunc
Func _GetTextSize($nText, $sFont = 'Microsoft Sans Serif', $iFontSize = 8.5, $iFontAttributes = 0)
;Author: Bugfix
;Modified: funkey
If $nText = '' Then Return
Local $hGui = GUICreate("Textmeter by Bugfix")
_GDIPlus_Startup()
Local $hFormat = _GDIPlus_StringFormatCreate(0)
Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, $iFontAttributes, 3)
Local $tLayout = _GDIPlus_RectFCreate(15, 171, 0, 0)
Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
Local $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
Local $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGui)
Local $aSize[2] = [$iWidth, $iHeight]
Return $aSize
EndFunc ;==>_GetTextSize
Danke fürs Testen! Vllt baue ich das ganze dann noch aus, dass man verschiedene Styles verwenden könnte und mehrere Tabs in einer Gui platzieren kann.