1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. funkey

Beiträge von funkey

  • SciLexer.dll und Lua

    • funkey
    • 1. Dezember 2009 um 19:18

    Nicht so ungeduldig sein :cursing:

    Es meldet sich sicher bald jemand der sich auskennt.

  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 1. Dezember 2009 um 19:15

    Danke Raupi, hab den Link repariert.


    Schaut euch das mal an, was da ein Kanadier gebastelt hat:

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <WinAPI.au3>
    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $hGui = GUICreate("Test OwnTab-Style 5", 640, 200)
    GUISetBkColor(0xFF080)

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Style5($hGui, 20, 60, 200, 125)
    Global $bckpic = GUICtrlCreatePic("", 0, 0, 0, 0, $WS_CLIPSIBLINGS)
    GUICtrlSetState(-1, $GUI_DISABLE)
    _GDIPlus_Startup()
    $guibitmap = startbmp($hGui, 200, 125)
    $guibitmap = _drawborder($guibitmap, 200, 125, 2, "0xffffff", "0x999999", 125/2) ;sets up the border on background
    finalizectrl($bckpic, $guibitmap)
    _OwnTab_Label("R.I.P.", 200, 125) ;<-- Das soll ein Scherz sein
    _OwnTab_Label("Das ist ein Scherz", 200, 225) ;<-- Das soll ein Scherz sein

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Style5($hGui, 220, 60, 200, 45)
    Global $bckpic = GUICtrlCreatePic("", 0, 0, 0, 0, $WS_CLIPSIBLINGS)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $guibitmap = startbmp($hGui, 200, 45)
    $guibitmap = _drawborder($guibitmap, 200, 45, 2, "0x444444", "0x999999", 45/2) ;sets up the border on background
    finalizectrl($bckpic, $guibitmap)
    _OwnTab_Label("Tab2", 200, 45)

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Style5($hGui, 420, 60, 200, 45)
    Global $bckpic = GUICtrlCreatePic("", 0, 0, 0, 0, $WS_CLIPSIBLINGS)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $guibitmap = startbmp($hGui, 200, 45)
    $guibitmap = _drawborder($guibitmap, 200, 45, 2, "0xFF4444", "0x999999", 45/2) ;sets up the border on background
    finalizectrl($bckpic, $guibitmap)
    _GDIPlus_Shutdown()
    _OwnTab_Label("Tab3", 200, 45)

    [/autoit] [autoit][/autoit] [autoit]

    GUISwitch($hGui)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    Local $msg
    Do
    $msg = GUIGetMsg()
    If $msg > 0 Then MsgBox(0, "OwnTab", "You pressed tab with ID " & $msg & ".")
    Until $msg = -3

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Label($sText, $iWidth, $iHeight, $iStyle = 0x201, $iExStyle = 0x0)
    Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, $iStyle, $iExStyle)
    GUICtrlSetBkColor(-1, -2)
    Return $Label
    EndFunc ;==>_OwnTab_Label

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Pic($sFilename, $iWidth, $iHeight, $iStyle = 0x0, $iExStyle = 0x0)
    Local $Pic = GUICtrlCreatePic($sFilename, 0, 0, $iWidth, $iHeight, $iStyle, $iExStyle)
    GUICtrlSetState(-1, 128) ;$GUI_DISABLE
    Return $Pic
    EndFunc ;==>_OwnTab_Pic

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Gradient($nStartColor, $nEndColor, $iWidth, $iHeight)
    Local $colorR = Dec(StringLeft(Hex($nStartColor, 6), 2))
    Local $colorG = Dec(StringMid(Hex($nStartColor, 6), 3, 2))
    Local $colorB = Dec(StringMid(Hex($nStartColor, 6), 5, 2))

    [/autoit] [autoit][/autoit] [autoit]

    Local $StepR = (Dec(StringLeft(Hex($nEndColor, 6), 2)) - $colorR) / ($iHeight - 1)
    Local $StepG = (Dec(StringMid(Hex($nEndColor, 6), 3, 2)) - $colorG) / ($iHeight - 1)
    Local $StepB = (Dec(StringMid(Hex($nEndColor, 6), 5, 2)) - $colorB) / ($iHeight - 1)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hGraph = GUICtrlCreateGraphic(0, 0, $iWidth, $iHeight)
    Local $sCol
    For $i = 0 To $iHeight - 1
    $sCol = StringFormat("0x%02X%02X%02X", $colorR + $StepR * $i, $colorG + $StepG * $i, $colorB + $StepB * $i)
    GUICtrlSetGraphic(-1, 8, $sCol) ;$GUI_GR_COLOR = 8
    GUICtrlSetGraphic(-1, 6, 0, $i) ;$GUI_GR_MOVE = 6
    GUICtrlSetGraphic(-1, 2, $iWidth, $i) ;$GUI_GR_LINE = 2
    Next
    Return $hGraph
    EndFunc ;==>_OwnTab_Gradient

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Style5($hWnd, $iX, $iY, $iWidth, $iHeight)
    Local $rgn, $rgn2, $diameter = $iHeight
    Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
    $rgn = _WinAPI_CreateRoundRectRgn($iWidth + 1, 0, 0, $iWidth, $diameter, $diameter)
    _WinAPI_SetWindowRgn($hGui, $rgn)
    GUISetState()
    Return $hGui
    EndFunc ;==>_OwnTab_Style5

    [/autoit] [autoit][/autoit] [autoit]

    Func startbmp($gui, $iWidth, $iHeight)
    ;Create a new bitmap, this way the original opened png is left unchanged
    $hBitmap = _GDIPlus_GraphicsCreateFromHWND(WinGetHandle($gui))
    $hImage = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hBitmap)
    _WinAPI_DeleteObject($hBitmap)
    Return $hImage
    EndFunc ;==>startbmp
    Func _drawborder($hBitmap, $gwt, $ght, $depth, $colour1, $colour2, $corner)
    $iC1 = StringReplace($colour1, "0x", "0xFF")
    $iC2 = StringReplace($colour2, "0x", "0xFF")
    $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Global $hBrush = _GDIPlus_BrushCreateSolid($iC1)
    Global $hBrush2 = _GDIPlus_BrushCreateSolid(0xFF7E3517)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aFactors[4] = [0.0, 0.6, 0.8, 1.0], $aPositions[4] = [0.0, 0.6, 0.8, 1.0]
    Local $bGammaCorrection = False
    $hBrush1 = _GDIPlus_CreateLineBrushFromRect(0, 0, $gwt, $ght, $aFactors, $aPositions, "0xFFBBBBBB", $iC1, 1)
    GDIPlus_SetLineGammaCorrection($hBrush1, $bGammaCorrection)
    $hBrush3 = _GDIPlus_CreateLineBrushFromRect(0, 0, $gwt, $ght, $aFactors, $aPositions, $iC1, $iC2, 3)
    GDIPlus_SetLineGammaCorrection($hBrush3, $bGammaCorrection)
    ; Global $hBrush1 = _GDIPlus_BrushCreateSolid($iC2)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 4)
    _GDIPlus_GraphicsDrawRoundRect($hGraphics, 0, 0, $gwt, $ght, $corner, $hBrush3)
    _GDIPlus_GraphicsDrawRoundRect($hGraphics, $depth, $depth, $gwt - ($depth * 2) - 2, $ght - ($depth * 2) - 2, $corner, $hBrush1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hBrush1)
    _GDIPlus_BrushDispose($hBrush2)
    _GDIPlus_GraphicsDispose($hGraphics)
    Return $hBitmap
    EndFunc ;==>_drawborder

    [/autoit] [autoit][/autoit] [autoit]

    Func finalizectrl($controlID, $hImage)
    $hWnd = GUICtrlGetHandle($controlID)
    $hbmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $aBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", 0x0172, "int", 0, "int", $hbmp)
    If $aBmp[0] <> 0 Then _WinAPI_DeleteObject($aBmp[0])
    _WinAPI_DeleteObject($hbmp)
    EndFunc ;==>finalizectrl

    [/autoit] [autoit][/autoit] [autoit]

    ;==== GDIPlus_CreateLineBrushFromRect === Malkey's function
    Func _GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _
    $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount

    [/autoit] [autoit][/autoit] [autoit]

    If $iArgb1 = Default Then $iArgb1 = 0xFF0000FF
    If $iArgb2 = Default Then $iArgb2 = 0xFFFF0000
    If $LinearGradientMode = -1 Or $LinearGradientMode = Default Then $LinearGradientMode = 0x00000001
    If $WrapMode = -1 Or $LinearGradientMode = Default Then $WrapMode = 1

    [/autoit] [autoit][/autoit] [autoit]

    $tRect = DllStructCreate("float X;float Y;float Width;float Height")
    $pRect = DllStructGetPtr($tRect)
    DllStructSetData($tRect, "X", $iX)
    DllStructSetData($tRect, "Y", $iY)
    DllStructSetData($tRect, "Width", $iWidth)
    DllStructSetData($tRect, "Height", $iHeight)
    $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _
    "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0)

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0]
    If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0]
    $iCount = UBound($aPositions)
    $tFactors = DllStructCreate("float[" & $iCount & "]")
    $pFactors = DllStructGetPtr($tFactors)
    For $iI = 0 To $iCount - 1
    DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1)
    Next
    $tPositions = DllStructCreate("float[" & $iCount & "]")
    $pPositions = DllStructGetPtr($tPositions)
    For $iI = 0 To $iCount - 1
    DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1)
    Next
    $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _
    "ptr", $pFactors, "ptr", $pPositions, "int", $iCount)
    Return $aRet[6] ; Handle of Line Brush
    EndFunc ;==>_GDIPlus_CreateLineBrushFromRect

    [/autoit] [autoit][/autoit] [autoit]

    Func GDIPlus_SetLineGammaCorrection($hBrush, $useGammaCorrection = True)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSetLineGammaCorrection", "hwnd", $hBrush, "int", $useGammaCorrection)
    Return $aResult[0]
    EndFunc ;==>GDIPlus_SetLineGammaCorrection

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_GraphicsDrawRoundRect($hGraphics, $iX, $iY, $iWidth, $iHeight, $iRadius, $hBrush = 0, $hPen = 0)
    _GDIPlus_PenCreate($hPen)
    Local $hPath = _GDIPlus_GraphicsPathCreate()
    _GDIPlus_GraphicsPathAddLine($hPath, $iX + $iRadius, $iY, $iX + $iWidth - ($iRadius * 2), $iY)
    _GDIPlus_GraphicsPathAddArc($hPath, $iX + $iWidth - ($iRadius * 2), $iY, $iRadius * 2, $iRadius * 2, 270, 90)
    _GDIPlus_GraphicsPathAddLine($hPath, $iX + $iWidth, $iY + $iRadius, $iX + $iWidth, $iY + $iHeight)
    ; _GDIPlus_GraphicsPathAddArc($hPath, $iX + $iWidth - ($iRadius * 2), $iY + $iHeight - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90)
    _GDIPlus_GraphicsPathAddLine($hPath, $iX + $iWidth, $iY + $iHeight, $iX, $iY + $iHeight)
    ; _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY + $iHeight - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90)
    _GDIPlus_GraphicsPathAddLine($hPath, $iX, $iY + $iHeight - ($iRadius * 2), $iX, $iY + $iRadius)
    _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY, $iRadius * 2, $iRadius * 2, 180, 90)

    [/autoit] [autoit][/autoit] [autoit]

    ;Draw the font onto the new bitmap
    _GDIPlus_GraphicsPathCloseFigure($hPath)
    If $hBrush <> 0 Then _GDIPlus_GraphicsFillPath($hGraphics, $hBrush, $hPath)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPen, $hPath)
    _GDIPlus_GraphicsPathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    EndFunc ;==>_GDIPlus_GraphicsDrawRoundRect

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_GraphicsPathCreate($iFillMode = 0)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", $iFillMode, "int*", 0);
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[2])
    EndFunc ;==>_GDIPlus_GraphicsPathCreate
    Func _GDIPlus_GraphicsPathAddLine($hGraphicsPath, $iX1, $iY1, $iX2, $iY2)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathLine", "hwnd", $hGraphicsPath, "float", $iX1, "float", $iY1, _
    "float", $iX2, "float", $iY2)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
    EndFunc ;==>_GDIPlus_GraphicsPathAddLine
    Func _GDIPlus_GraphicsPathAddArc($hGraphicsPath, $iX, $iY, $iWidth, $iHeight, $iStartAngle, $iSweepAngle)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathArc", "hwnd", $hGraphicsPath, "float", $iX, "float", $iY, _
    "float", $iWidth, "float", $iHeight, "float", $iStartAngle, "float", $iSweepAngle)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
    EndFunc ;==>_GDIPlus_GraphicsPathAddArc
    Func _GDIPlus_GraphicsPathCloseFigure($hGraphicsPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "hwnd", $hGraphicsPath)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
    EndFunc ;==>_GDIPlus_GraphicsPathCloseFigure
    Func _GDIPlus_GraphicsPathDispose($hGraphicsPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeletePath", "hwnd", $hGraphicsPath)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
    EndFunc ;==>_GDIPlus_GraphicsPathDispose
    Func _GDIPlus_GraphicsDrawPath($hGraphics, $hPen, $hGraphicsPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawPath", "hwnd", $hGraphics, "hwnd", $hPen, "hwnd", $hGraphicsPath)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
    EndFunc ;==>_GDIPlus_GraphicsDrawPath
    Func _GDIPlus_GraphicsFillPath($hGraphics, $hBrush, $hGraphicsPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "hwnd", $hGraphics, "hwnd", $hBrush, "hwnd", $hGraphicsPath)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
    EndFunc ;==>_GDIPlus_GraphicsFillPath

    [/autoit]
  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 1. Dezember 2009 um 09:03

    Jetzt kann jeder seine eigenen OwnTab-Styles entwerfen! Schreibt euch eure eigene Style-Func für die OwnTab-UDF oder ihr schreibt mir eure Ideen, die ich dann hoffentlich umsetzen kann!

    Hier die Vorlage mit den derzeitigen Styles:

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #Include <WinAPI.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("Overview OwnTab-Styles", 640, 400)
    GUISetBkColor(0xFF080)

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Style1($hGui, "Style 1", 20, 20, 200, 45)
    _OwnTab_Style1($hGui, "Style 1", 220, 20, 200, 45)
    _OwnTab_Style1($hGui, "Style 1", 420, 20, 200, 45)

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Style2($hGui, "Style 2", 20, 80, 200, 45)
    _OwnTab_Style2($hGui, "Style 2", 220, 80, 200, 45)
    _OwnTab_Style2($hGui, "Style 2", 420, 80, 200, 45)

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Style3($hGui, "Style 3", 20, 140, 200, 45)
    _OwnTab_Style3($hGui, "Style 3", 220, 140, 200, 45)
    _OwnTab_Style3($hGui, "Style 3", 420, 140, 200, 45)

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Style4($hGui, "Style 4", 20, 200, 200, 45)
    _OwnTab_Style4($hGui, "Style 4", 220, 200, 200, 45)
    _OwnTab_Style4($hGui, "Style 4", 420, 200, 200, 45)

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Style5($hGui, "Style 5", 20, 260, 200, 45)
    _OwnTab_Style5($hGui, "Style 5", 220, 260, 200, 45)
    _OwnTab_Style5($hGui, "Style 5", 420, 260, 200, 45)

    [/autoit] [autoit][/autoit] [autoit]

    GUISwitch($hGui)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    Local $msg
    Do
    $msg = GUIGetMsg()
    If $msg > 0 Then MsgBox(0, "OwnTab", "Tab mit der ID " & $msg & " gedrückt.")
    Until $msg = -3

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Style1($hWnd, $sText, $iX, $iY, $iWidth, $iHeight, $sIcon = "")
    Local $rgn, $rgn2, $rel = $iHeight/5
    Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
    $rgn = _WinAPI_CreateRectRgn(0, $rel, $iX + $iWidth, $iY + $iHeight)
    For $i = 0 To $rel - 1
    $rgn2 = _WinAPI_CreateRectRgn($rel - $i, $i, $iWidth - $rel + $i + 1, $i + 1)
    _WinAPI_CombineRgn($rgn, $rgn, $rgn2, $RGN_OR)
    _WinAPI_DeleteObject($rgn2)
    Next
    _WinAPI_SetWindowRgn($hGui, $rgn)
    Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x201 + ($sIcon <> ""), 1)
    GUICtrlSetBkColor(-1, -2)
    GUISetState()
    Return SetExtended($hGui, $Label)
    EndFunc ;==>_OwnTabCreateTab

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Style2($hWnd, $sText, $iX, $iY, $iWidth, $iHeight, $sIcon = "")
    Local $rgn, $rgn2, $rel = $iHeight/5
    Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
    Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x201 + ($sIcon <> ""), 1)
    GUICtrlSetBkColor(-1, -2)
    GUISetState()
    Return SetExtended($hGui, $Label)
    EndFunc ;==>_OwnTabCreateTab

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Style3($hWnd, $sText, $iX, $iY, $iWidth, $iHeight, $sIcon = "")
    Local $rgn, $rgn2, $diameter = $iWidth
    Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
    $rgn = _WinAPI_CreateRectRgn(0, $iHeight/2, $iWidth, $iHeight)
    $rgn2 = _WinAPI_CreateRoundRectRgn(0, 0, $iWidth, $iHeight, $diameter, $diameter)
    _WinAPI_CombineRgn($rgn, $rgn, $rgn2, $RGN_OR)
    _WinAPI_DeleteObject($rgn2)
    _WinAPI_SetWindowRgn($hGui, $rgn)
    Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x201 + ($sIcon <> ""), 1)
    GUICtrlSetBkColor(-1, -2)
    GUISetState()
    Return SetExtended($hGui, $Label)
    EndFunc ;==>_OwnTabCreateTab

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Style4($hWnd, $sText, $iX, $iY, $iWidth, $iHeight, $sIcon = "")
    Local $rgn, $rgn2, $rel = $iHeight/5
    Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
    $rgn = _WinAPI_CreateRectRgn($rel, 0, $iWidth - $rel, 1)
    For $i = 1 To $iHeight - 1
    $rgn2 = _WinAPI_CreateRectRgn($rel - ($rel / $iHeight * $i), $i, $iWidth - $rel + ($rel / $iHeight * $i) + 1, $i + 1)
    _WinAPI_CombineRgn($rgn, $rgn, $rgn2, $RGN_OR)
    _WinAPI_DeleteObject($rgn2)
    Next
    _WinAPI_SetWindowRgn($hGui, $rgn)
    Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x201 + ($sIcon <> ""), 1)
    GUICtrlSetBkColor(-1, -2)
    GUISetState()
    Return SetExtended($hGui, $Label)
    EndFunc ;==>_OwnTabCreateTab

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Style5($hWnd, $sText, $iX, $iY, $iWidth, $iHeight, $sIcon = "")
    Local $rgn, $rgn2, $diameter = $iHeight
    Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
    $rgn = _WinAPI_CreateRoundRectRgn($iWidth+ 1, 0, 0, $iWidth, $diameter, $diameter)
    _WinAPI_SetWindowRgn($hGui, $rgn)
    Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x201 + ($sIcon <> ""), 1)
    GUICtrlSetBkColor(-1, -2)
    GUISetState()
    Return SetExtended($hGui, $Label)
    EndFunc ;==>_OwnTabCreateTab

    [/autoit]

    Edit: Styles hinzugefügt

  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 30. November 2009 um 15:31

    Hab mal was getestet, um die typischen "Tab-Ecken" zu bekommen. :rock:
    Jetzt hab ich wieder ein Problem mit den "Tab in Tabs", aber das werde ich später lösen.

    Example
    [autoit]

    #include "OwnTab.au3"

    [/autoit] [autoit][/autoit] [autoit]

    Local $hGui = GUICreate("Funkey's OwnTab-UDF Example", 500, 600)
    GUISetBkColor(0xbbbbbb)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aTabText[5] = ["Settings", "Register without icon", "Pic", "Status", "Tab in Tab"] ;Declare the regions for the OwnTab-control
    Local $aTabIcons[5][2] = [["shell32.dll", -131],[""],["shell32.dll", -140],["shell32.dll", -91], ["shell32.dll", -44]]
    Global $aCtrlTab = _OwnTab_Create($hGui, $aTabText, 10, 10, 480, 300, 30, 0xD5D5D5, 0xCFE0E7, 0xCFE0E7, $aTabIcons)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aTabTip[5] = ["Tip Item 1", "Tip Item 2", "Tip Item 3", "Alarm-Register", ""]
    _OwnTab_SetTip($aCtrlTab, $aTabTip) ;set the tooltips for the OwnTab-control

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab1
    _OwnTab_Add($aCtrlTab) ;Start controls tab1
    Global $Edit1 = GUICtrlCreateEdit("Edit in Tab1", 20, 55, 300, 50, 0)
    Global $Button1 = GUICtrlCreateButton("Simulate an alarm", 20, 120, 300, 20)
    Global $Box1 = GUICtrlCreateCheckbox("Switch on hover - set time -->", 30, 180)
    GUICtrlSetBkColor(-1, 0xCFE0E7)
    Global $Input1 = GUICtrlCreateInput("1", 200, 180, 50, 20)
    GUICtrlCreateUpdown($Input1)
    GUICtrlSetLimit(-1, 15, 1)
    #EndRegion Tab1

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab2
    _OwnTab_Add($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

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab3
    _OwnTab_Add($aCtrlTab) ;Start controls tab3
    Global $Labe3 = GUICtrlCreateLabel("If you see this label, you can change the picture-path in scriptline " &@ScriptLineNumber + 1 & "!!", 40, 150, 400, 30, 0x201)
    Global $Edit3 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 20, 55, 460, 280)
    #EndRegion Tab3

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab4
    _OwnTab_Add($aCtrlTab) ;Start controls tab4
    Global $Button4 = GUICtrlCreateButton("Acknowledge the alarm", 20, 120, 300, 20)
    Global $Button5 = GUICtrlCreateButton("Enable tab 3", 20, 150, 300, 20)
    Global $Button6 = GUICtrlCreateButton("Disable tab 3", 20, 180, 300, 20)
    Global $Button7 = GUICtrlCreateButton("Hide tab 2", 20, 240, 300, 20)
    Global $Button8 = GUICtrlCreateButton("Show tab 2", 20, 210, 300, 20)
    #EndRegion Tab4

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab5 and "Tab in Tab"
    _OwnTab_Add($aCtrlTab) ;Start controls tab5
    GUICtrlCreateLabel("Style Black", 30, 50, 200, 20, 0x201)
    GUICtrlCreateLabel("Style White", 270, 50, 200, 20, 0x201)
    #EndRegion Tab5

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_End($aCtrlTab) ;new: end control-definition AND inizialize the OwnTab

    [/autoit] [autoit][/autoit] [autoit]

    #Region OwnTab2
    Local $aTabText[2] = ["Tab1", "New Info"] ;Declare the regions for the OwnTab-control
    Local $aTabIcons[2][2] = [["shell32.dll", -21],["shell32.dll", -41]]
    Global $aCtrlTab2 = _OwnTab_Create($hGui, $aTabText, 30, 350, 200, 200, 25, 0xD5D5D5, 0xffc0c0, 0xFFc0c0, $aTabIcons)
    _OwnTab_Add($aCtrlTab2) ;Start controls tab1
    Global $BtnSet = GUICtrlCreateButton("Simulate", 80, 450, 100, 20)
    _OwnTab_Add($aCtrlTab2) ;Start controls tab2
    Global $BtnReset = GUICtrlCreateButton("Acknowledge", 80, 470, 100, 20)
    _OwnTab_End($aCtrlTab2)
    #EndRegion

    [/autoit] [autoit][/autoit] [autoit]

    #Region OwnTab3
    Local $aTabText[2] = ["Tab1", "Tab2"] ;Declare the regions for the OwnTab-control
    Local $aTabIcons[2][2] = [["shell32.dll", -11],["shell32.dll", -61]]
    Global $aCtrlTab3 = _OwnTab_Create($hGui, $aTabText, 270, 350, 200, 190, 35, 0xD5D5D5, 0x00ff00, 0x00ff00, $aTabIcons)
    _OwnTab_Add($aCtrlTab3) ;Start controls tab1
    GUICtrlCreateLabel("Just testing...", 280, 450, 100, 20)
    GUICtrlSetBkColor(-1, -2)
    _OwnTab_Add($aCtrlTab3) ;Start controls tab2
    GUICtrlCreateLabel("Hello from tab2", 280, 450, 100, 20)
    GUICtrlSetBkColor(-1, -2)
    _OwnTab_End($aCtrlTab3)
    #EndRegion

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_SetFontCol($aCtrlTab, 0xFF) ;new: set font-color
    _OwnTab_SetFontCol($aCtrlTab2, 0xFF0000) ;new: set font-color

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()
    _OwnTab_Hover($aCtrlTab, 0xFFFF88) ;start hover-function if you want
    _OwnTab_AlarmInit()

    [/autoit] [autoit][/autoit] [autoit]

    ;~ _ArrayDisplay($aCtrlTab)
    Local $msg

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    For $a = 1 To UBound($aCtrlTab, 1) - 1
    If $msg = $aCtrlTab[$a][0] Then
    _OwnTab_Switch($aCtrlTab, $a)
    ;~ If $a = 5 Then
    ;~ _OwnTab_Switch($aCtrlTab2, $aCtrlTab2[0][0], 1)
    ;~ _OwnTab_Switch($aCtrlTab3, $aCtrlTab3[0][0], 1)
    ;~ EndIf
    EndIf
    Next
    For $a = 1 To UBound($aCtrlTab2, 1) - 1
    If $msg = $aCtrlTab2[$a][0] Then
    _OwnTab_Switch($aCtrlTab2, $a)
    EndIf
    Next
    For $a = 1 To UBound($aCtrlTab3, 1) - 1
    If $msg = $aCtrlTab3[$a][0] Then
    _OwnTab_Switch($aCtrlTab3, $a)
    EndIf
    Next
    Switch $msg
    Case $Button1
    _OwnTab_SetAlarm($aCtrlTab, 4, 0xFF0000)
    Case $Button4
    _OwnTab_ResetAlarm($aCtrlTab, 4)
    Case $BtnSet
    _OwnTab_SetAlarm($aCtrlTab2, 2, 0xFFFF)
    Case $BtnReset
    _OwnTab_ResetAlarm($aCtrlTab2, 2)
    Case $Button5
    _OwnTab_Enable($aCtrlTab, 3)
    Case $Button6
    _OwnTab_Disable($aCtrlTab, 3)
    Case $Button7
    _OwnTab_Hide($aCtrlTab, 2)
    Case $Button8
    _OwnTab_Show($aCtrlTab, 2)
    Case $Box1
    If GUICtrlRead($Box1) = 1 Then
    _OwnTab_Hover($aCtrlTab, 0xFFFF88, GUICtrlRead($Input1))
    Else
    _OwnTab_Hover($aCtrlTab, 0xFFFF88, 0)
    EndIf
    Case $Input1
    If GUICtrlRead($Box1) = 1 Then _OwnTab_Hover($aCtrlTab, 0xFFFF88, GUICtrlRead($Input1))
    Case -3
    Exit
    EndSwitch
    Sleep(10)
    WEnd

    [/autoit]
    New OwnTab.au3
    [autoit]

    #include-once
    #include <GDIPlus.au3>
    #include <Array.au3>
    #include <Constants.au3>
    #include <WindowsConstants.au3>
    #Include <Timers.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #cs
    Copyrights to funkey from Autoit.de
    #ce

    [/autoit] [autoit][/autoit] [autoit]

    Local $HoverArray[1], $ControlID, $Global_I = 0, $__ControlID, $HoverActive = 0, $Temp_Found = 0, $szTemp_Array[2]
    Local $OwnTabHoverCol[2], $OwnTabHoverHelp[1], $OwnTabHoverSwitch, $aOwnTabHoverCount, $OwnTabHoverCtrl
    Local $aOwnTabAlarm[1][3], $iOwnTabAlarm, $hOwnTabGui, $hTimerAlarm, $hTimerHover

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    Opt("OnExitFunc", "_OwnTab_OnExit")

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Create($hWnd, $aTabText, $xPos, $yPos, $iWidth, $iHeight, $iItemHeight = -1, $nColNoSel = -1, $nColSel = -1, $nColBg = -1, $aIcons = "")
    Local $aSize, $aSize2[UBound($aTabText)][2], $xLast = 0, $aCtrl[UBound($aTabText) + 1][11], $iOffset = 0
    If Not IsArray($aIcons) Then
    Local $Icons[UBound($aTabText)][2]
    Else
    Local $Icons = $aIcons
    EndIf
    If Not IsArray($aTabText) Then Return SetError(1, 0, "")
    GUICtrlCreateLabel("", $xPos, $yPos + $iItemHeight, $iWidth, $iHeight, 0x411000, 1)
    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])
    $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]
    If $Icons[$i][0] <> "" Then
    $iOffset = $iItemHeight
    $aTabText[$i] &= " "
    Else
    $iOffset = 0
    EndIf
    $aCtrl[$i + 1][7] = $Icons[$i][0] ;filename for icon
    $aCtrl[$i + 1][8] = $Icons[$i][1] ;index for icon
    $aCtrl[$i + 1][9] = $aSize[0] + 5 + $iOffset ;labelwidth
    $aCtrl[$i + 1][0] = _OwnTab_CreateTab($hWnd, $aTabText[$i], $xPos + $xLast + 5, $yPos + 2, $aCtrl[$i + 1][9], $iItemHeight, $nColNoSel, $Icons[$i][0])
    $aCtrl[$i + 1][10] = @extended ;hWnd of the tab (Child-Gui)
    _HoverAddCtrl($aCtrl[$i + 1][0])
    If $Icons[$i][0] <> "" Then
    $aCtrl[$i + 1][6] = GUICtrlCreateIcon($Icons[$i][0], $Icons[$i][1], 6, 4, $iItemHeight - 8, $iItemHeight - 8)
    Else
    $aCtrl[$i + 1][6] = GUICtrlCreateDummy()
    EndIf
    GUICtrlCreateLabel($aCtrl[$i + 1][7], -200, -200) ;For information
    GUICtrlCreateLabel($aCtrl[$i + 1][8], -200, -200) ;For information
    GUICtrlCreateLabel($iItemHeight - 6, -200, -200) ;For information
    GUICtrlCreateLabel($aCtrl[$i + 1][10], -200, -200) ;hWnd for information
    $aCtrl[$i + 1][2] = $nColNoSel
    $aCtrl[$i + 1][3] = $nColSel
    $xLast += $aCtrl[$i + 1][9]
    Next
    GUISwitch($hWnd)
    $xLast = 0
    For $i = 0 To UBound($aTabText) - 1
    If $Icons[$i][0] <> "" Then
    $iOffset = $iItemHeight
    Else
    $iOffset = 0
    EndIf
    $aCtrl[$i + 1][1] = GUICtrlCreateLabel("", $xPos + $xLast + 7, $yPos + $iItemHeight - 1, $aSize2[$i][0] + 1 + $iOffset, 4)
    GUICtrlSetBkColor(-1, $nColSel)
    $xLast += $aSize2[$i][0] + 5 + $iOffset
    Next
    $aCtrl[0][1] = $iItemHeight
    $aCtrl[0][2] = $nColNoSel
    $aCtrl[0][3] = $nColSel
    $aCtrl[0][9] = $yPos + 2
    $hOwnTabGui = $hWnd
    Return $aCtrl
    EndFunc ;==>_OwnTab_Create

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Switch(ByRef $aOwnTab, $iIndex, $fForce = 0)
    _OwnTab_UnRegisterHover($aOwnTab, $iIndex)
    If _OwnTab_IsAlarmed($aOwnTab[$iIndex][0]) Then $aOwnTabAlarm[@extended][2] = $aOwnTabAlarm[@extended][1]
    $HoverActive = 0
    If $aOwnTab[0][0] = $iIndex And $fForce = 0 Then Return
    Local $hWnd_old
    For $s = 1 To UBound($aOwnTab, 1) - 1
    If $iIndex <> $s Then
    GUICtrlSetState($aOwnTab[$s][1], 32) ;$GUI_HIDE
    GUICtrlSetFont($aOwnTab[$s][0], -1, 400)
    If Not _OwnTab_IsAlarmed($aOwnTab[$s][0]) Then
    $hWnd_old = GUISwitch($aOwnTab[$s][10])
    GUISetBkColor($aOwnTab[$s][2])
    GUISwitch($hWnd_old)
    EndIf
    If _ArraySearch($OwnTabHoverHelp, $aOwnTab[$s][0]) = -1 Then
    _OwnTab_RegisterHover($aOwnTab, $s)
    EndIf
    Else
    GUICtrlSetFont($aOwnTab[$s][0], -1, 1000)
    If Not _OwnTab_IsAlarmed($aOwnTab[$s][0]) Then
    $hWnd_old = GUISwitch($aOwnTab[$s][10])
    GUISetBkColor($aOwnTab[$s][3])
    GUISwitch($hWnd_old)
    EndIf
    GUICtrlSetState($aOwnTab[$s][1], 16) ;$GUI_SHOW
    EndIf
    Next
    If $aOwnTab[0][0] = "" Or $fForce Then
    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
    Else
    For $t = $aOwnTab[$aOwnTab[0][0] - 1][4] To $aOwnTab[$aOwnTab[0][0]][4]
    GUICtrlSetState($t, 32) ;$GUI_HIDE
    Next
    For $t = $aOwnTab[$iIndex - 1][4] To $aOwnTab[$iIndex][4]
    GUICtrlSetState($t, 16) ;$GUI_SHOW
    Next
    EndIf
    $aOwnTab[0][0] = $iIndex
    EndFunc ;==>_OwnTab_Switch

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_SetTip(ByRef $aOwnTab, $ToolTips = "", $iIndex = "")
    If IsArray($ToolTips) Then
    For $i = 1 To UBound($aOwnTab, 1) - 1
    $aOwnTab[$i][5] = $ToolTips[$i - 1]
    GUICtrlSetTip($aOwnTab[$i][0], $ToolTips[$i - 1])
    Next
    Else
    If $iIndex = "" Then Return SetError(1)
    $aOwnTab[$iIndex][5] = $ToolTips
    GUICtrlSetTip($aOwnTab[$iIndex][0], $ToolTips)
    EndIf
    EndFunc ;==>_OwnTab_SetTip

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_AlarmInit($iTime = 555)
    If Not $hTimerAlarm Then
    $hTimerAlarm = _Timer_SetTimer($hOwnTabGui, $iTime, "_OwnTab_AlarmBlink")
    Else
    $hTimerAlarm = _Timer_SetTimer($hOwnTabGui, $iTime, "", $hTimerAlarm)
    EndIf
    EndFunc ;==>_OwnTab_AlarmInit

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_AlarmBlink($hWnd, $Msg, $iIDTimer, $dwTime)
    Local $AlarmColAct
    $iOwnTabAlarm = Not $iOwnTabAlarm
    For $i = 1 To UBound($aOwnTabAlarm, 1) - 1
    If $iOwnTabAlarm Then
    $AlarmColAct = $aOwnTabAlarm[$i][2]
    Else
    $AlarmColAct = $aOwnTabAlarm[$i][1]
    EndIf
    GUISetBkColor($AlarmColAct, GUICtrlRead($aOwnTabAlarm[$i][0] + 5))
    Next
    EndFunc ;==>_OwnTab_AlarmBlink

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_SetAlarm(ByRef $aOwnTab, $iIndex, $nAlarmSel = 0xFF0000)
    Local $hCtrl = $aOwnTab[$iIndex][0]
    Local $iSearch = _ArraySearch($aOwnTabAlarm, $hCtrl)
    If $iSearch <> -1 Then
    $aOwnTabAlarm[$iSearch][2] = $aOwnTab[$iIndex][2]
    Return
    EndIf
    ReDim $aOwnTabAlarm[UBound($aOwnTabAlarm, 1) + 1][3]
    $aOwnTabAlarm[UBound($aOwnTabAlarm, 1) - 1][0] = $hCtrl
    $aOwnTabAlarm[UBound($aOwnTabAlarm, 1) - 1][1] = $nAlarmSel
    $aOwnTabAlarm[UBound($aOwnTabAlarm, 1) - 1][2] = $aOwnTab[$iIndex][2]
    EndFunc ;==>_OwnTab_SetAlarm

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_ResetAlarm(ByRef $aOwnTab, $iIndex)
    Local $hCtrl = $aOwnTab[$iIndex][0]
    Local $iSearch = _ArraySearch($aOwnTabAlarm, $hCtrl)
    If $iSearch = -1 Then Return
    _ArrayDelete($aOwnTabAlarm, $iSearch)
    $aOwnTab[$iIndex][2] = $aOwnTab[0][2]
    $aOwnTab[$iIndex][3] = $aOwnTab[0][3]
    If $aOwnTab[0][0] <> $iIndex Then
    GUISetBkColor($aOwnTab[0][2], GUICtrlRead($aOwnTab[$iIndex][0] + 5))
    Else
    GUISetBkColor($aOwnTab[0][3], GUICtrlRead($aOwnTab[$iIndex][0] + 5))
    GUICtrlSetBkColor($aOwnTab[$iIndex][1], $aOwnTab[0][3])
    EndIf
    EndFunc ;==>_OwnTab_ResetAlarm

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Add(ByRef $aOwnTab)
    Local $i = 0
    While 1
    If $aOwnTab[$i][4] = "" Then ExitLoop
    $i += 1
    WEnd
    $aOwnTab[$i][4] = GUICtrlCreateDummy()
    EndFunc ;==>_OwnTab_Add

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_End(ByRef $aOwnTab, $iIndex = 1)
    $aOwnTab[UBound($aOwnTab, 1) - 1][4] = GUICtrlCreateDummy()
    _OwnTab_Switch($aOwnTab, $iIndex)
    EndFunc ;==>_OwnTab_End

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Hover($aOwnTab, $nColHover, $fSwitch = 0, $iTime = 50)
    $OwnTabHoverCol[0] = $nColHover
    $OwnTabHoverCol[1] = $aOwnTab[0][2]
    $OwnTabHoverSwitch = $fSwitch
    If Not $hTimerHover Then
    $hTimerHover = _Timer_SetTimer($hOwnTabGui, $iTime, "_ProcessHover")
    Else
    $hTimerHover = _Timer_SetTimer($hOwnTabGui, $iTime, "", $hTimerHover)
    EndIf
    EndFunc ;==>_OwnTab_Hover

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_RegisterHover($aOwnTab, $iIndex)
    If _ArraySearch($HoverArray, $aOwnTab[$iIndex][0]) = -1 Then _HoverAddCtrl($aOwnTab[$iIndex][0])
    EndFunc ;==>_OwnTab_RegisterHover

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_UnRegisterHover($aOwnTab, $iIndex)
    Local $iSearch = _ArraySearch($HoverArray, $aOwnTab[$iIndex][0])
    If $iSearch <> -1 Then _ArrayDelete($HoverArray, $iSearch)
    EndFunc ;==>_OwnTab_UnRegisterHover

    [/autoit] [autoit][/autoit] [autoit]

    #Region Disable and Enable Tab-Register
    Func _OwnTab_Disable($aOwnTab, $iIndex)
    GUICtrlSetState($aOwnTab[$iIndex][0], 128)
    _OwnTab_UnRegisterHover($aOwnTab, $iIndex)
    Local $iSearch = _ArraySearch($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
    If $iSearch = -1 Then _ArrayAdd($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
    EndFunc ;==>_OwnTab_Disable

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Enable($aOwnTab, $iIndex)
    GUICtrlSetState($aOwnTab[$iIndex][0], 64)
    _OwnTab_RegisterHover($aOwnTab, $iIndex)
    Local $iSearch = _ArraySearch($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
    If $iSearch <> -1 Then _ArrayDelete($OwnTabHoverHelp, $iSearch)
    EndFunc ;==>_OwnTab_Enable
    #EndRegion Disable and Enable Tab-Register

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Hide(ByRef $aOwnTab, $iIndex)
    If $iIndex = 0 Or $iIndex > UBound($aOwnTab, 1) - 1 Then Return SetError(1)
    Local $HWnd = HWnd(GUICtrlRead($aOwnTab[$iIndex][0] + 5))
    If Not BitAND(WinGetState($HWnd), 2) Then Return
    GUISetState(@SW_HIDE, $HWnd)
    GUICtrlSetState($aOwnTab[$iIndex][1], 32) ;$GUI_HIDE

    [/autoit] [autoit][/autoit] [autoit]

    Local $Offset = 3
    For $o = 0 To $iIndex - 1
    $Offset += $aOwnTab[$o][9] - 0
    Next

    [/autoit] [autoit][/autoit] [autoit]

    For $o = $iIndex + 1 To UBound($aOwnTab, 1) - 1
    WinMove(HWnd(GUICtrlRead($aOwnTab[$o][0] + 5)), "", $Offset, $aOwnTab[0][9])
    GUICtrlSetPos($aOwnTab[$o][1], $Offset + 2, $aOwnTab[0][9] + $aOwnTab[0][1] - 3)
    $Offset += $aOwnTab[$o][9]
    Next
    If $iIndex = $aOwnTab[0][0] Then
    If $iIndex = 1 Then
    _OwnTab_Switch($aOwnTab, 2)
    Else
    _OwnTab_Switch($aOwnTab, $iIndex - 1)
    EndIf
    EndIf
    EndFunc ;==>_OwnTab_Hide

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Show(ByRef $aOwnTab, $iIndex, $iActivate = 0)
    If $iIndex = 0 Or $iIndex > UBound($aOwnTab, 1) + 1 Then Return SetError(1)
    Local $HWnd = HWnd(GUICtrlRead($aOwnTab[$iIndex][0] + 5))
    If BitAND(WinGetState($HWnd), 2) Then Return

    [/autoit] [autoit][/autoit] [autoit]

    Local $Offset = 3
    For $o = 0 To UBound($aOwnTab, 1) - 2
    $Offset += $aOwnTab[$o][9] - 0
    Next

    [/autoit] [autoit][/autoit] [autoit]

    For $o = UBound($aOwnTab, 1) - 1 To $iIndex + 1 Step -1
    WinMove(HWnd(GUICtrlRead($aOwnTab[$o][0] + 5)), "", $Offset, $aOwnTab[0][9])
    GUICtrlSetPos($aOwnTab[$o][1], $Offset + 2, $aOwnTab[0][9] + $aOwnTab[0][1] - 3)
    $Offset -= $aOwnTab[$o - 1][9]
    Next
    GUISetState(@SW_SHOW, $HWnd)
    If $iActivate Then
    _OwnTab_Switch($aOwnTab, $iIndex)
    EndIf
    EndFunc ;==>_OwnTab_Show

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_SetFontCol($aOwnTab, $nColor, $iIndex = "")
    If $iIndex = "" Then
    For $i = 1 To UBound($aOwnTab, 1) - 1
    GUICtrlSetColor($aOwnTab[$i][0], $nColor)
    Next
    Else
    If $iIndex < 1 Or $iIndex >= UBound($aOwnTab, 1) Then Return SetError(1)
    GUICtrlSetColor($aOwnTab[$iIndex][0], $nColor)
    EndIf
    EndFunc ;==>_OwnTab_SetFontCol

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_SetOnEvent($aOwnTab, $sFunc = "", $iIndex = "")
    If $sFunc = "" Then $sFunc = "_OwnTab_OnEvent"
    If $iIndex = "" Then
    For $f = 1 To UBound($aOwnTab, 1) -1
    GUICtrlSetOnEvent($aOwnTab[$f][0], $sFunc)
    Next
    Else
    If $iIndex < 1 Or $iIndex >= UBound($aOwnTab, 1) Then Return SetError(1)
    GUICtrlSetOnEvent($aOwnTab[$iIndex][0], $sFunc)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_OnEvent() ;for example
    ;~ For $a = 1 To UBound($aCtrlTab, 1) -1
    ;~ If @GUI_CtrlId = $aCtrlTab[$a][0] Then ExitLoop
    ;~ Next
    ;~ If $a < UBound($aCtrlTab, 1) Then _OwnTab_Switch($aCtrlTab, $a)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_CreateTab($hWnd, $sText, $iX, $iY, $iWidth, $iHeight, $nCol = 0xbbbbbb, $sIcon = "")
    Local $rgn, $rgn2, $rel = $iHeight/5
    Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
    GUISetBkColor($nCol)
    $rgn = _WinAPI_CreateRectRgn(0, $rel, $iX + $iWidth, $iY + $iHeight)
    For $i = 0 To $rel - 1
    $rgn2 = _WinAPI_CreateRectRgn($rel - $i, $i, $iWidth - $rel + $i + 1, $i + 1)
    _WinAPI_CombineRgn($rgn, $rgn, $rgn2, $RGN_OR)
    _WinAPI_DeleteObject($rgn2)
    Next
    _WinAPI_SetWindowRgn($hGui, $rgn)
    Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x201 + ($sIcon <> ""), 1)
    GUICtrlSetBkColor(-1, -2)
    GUISetState()
    Return SetExtended($hGui, $Label)
    EndFunc ;==>_OwnTabCreateTab

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_OnExit()
    _GDIPlus_Shutdown()
    If $hTimerAlarm Then _Timer_KillTimer($hOwnTabGui, $hTimerAlarm)
    If $hTimerHover Then _Timer_KillTimer($hOwnTabGui, $hTimerHover)
    EndFunc ;==>_OwnTab_Exit

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    Func _ProcessHover($hWnd, $Msg, $iIDTimer, $dwTime)
    If $OwnTabHoverSwitch > 1 And $OwnTabHoverCtrl <> "" Then
    If $aOwnTabHoverCount < $OwnTabHoverSwitch Then $aOwnTabHoverCount += 1
    If $aOwnTabHoverCount >= $OwnTabHoverSwitch Then
    ControlClick($hOwnTabGui, "", $OwnTabHoverCtrl)
    $aOwnTabHoverCount = 0
    $OwnTabHoverCtrl = ""
    EndIf
    EndIf
    $ControlID = _HoverCheck()
    If IsArray($ControlID) Then
    If $ControlID[0] = "AcquiredHover" Then
    $OwnTabHoverCtrl = $ControlID[1]
    $aOwnTabHoverCount = 0
    If $OwnTabHoverSwitch = "1" Then
    Return ControlClick($hOwnTabGui, "", $OwnTabHoverCtrl)
    Else
    _HoverFound($ControlID[1])
    EndIf
    Else
    If $ControlID[1] <> "" Then
    _HoverLost($ControlID[1])
    $OwnTabHoverCtrl = ""
    EndIf
    EndIf
    EndIf
    EndFunc ;==>_ProcessHover

    [/autoit] [autoit][/autoit] [autoit]

    Func _HoverLost($ControlID)
    If _OwnTab_IsAlarmed($ControlID) Then Return
    GUISetBkColor($OwnTabHoverCol[1], GUICtrlRead($ControlID + 5))
    EndFunc ;==>_HoverLost

    [/autoit] [autoit][/autoit] [autoit]

    Func _HoverFound($ControlID)
    If _OwnTab_IsAlarmed($ControlID) Then Return
    GUISetBkColor($OwnTabHoverCol[0], GUICtrlRead($ControlID + 5))
    EndFunc ;==>_HoverFound

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_IsAlarmed($hCtrl)
    Local $iSearch = _ArraySearch($aOwnTabAlarm, $hCtrl)
    If $iSearch = -1 Then Return 0
    Return SetExtended($iSearch, 1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    #Region _MouseHover.au3
    ;====================================================================================================================================
    ; UDF Name: _MouseHover.au3
    ;
    ; Author: marfdaman (Marvin)
    ;
    ; Contributions: RazerM (adding SetText parameter to _HoverFound and _HoverUndo).
    ;
    ; email: marfdaman at gmail dot com
    ;
    ; Use: Enable hover events for controls
    ;
    ; Note(s): If you want to use this i.c.w. an AdlibEnable in your current script, make your Adlib call "_HoverCheck()" as well.
    ; In this case, _HoverOn must NOT be called.
    ;====================================================================================================================================

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Description: _HoverAddCtrl
    ; Parameter(s): $___ControlID -> Control ID of control to be hoverchecked
    ;
    ; Requirement: Array.au3
    ; Return Value(s): None
    ;===============================================================================
    Func _HoverAddCtrl($___ControlID)
    _ArrayAdd($HoverArray, $___ControlID)
    EndFunc ;==>_HoverAddCtrl

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Description: Checks whether the mousecursor is hovering over any of the defined controls.
    ; Parameter(s): None
    ; Requirement: None
    ; Return Value(s): If a control has matched, an array will be returned, with $array[1] being either
    ; "AcquiredHover" or "LostHover". $array[2] will contain the control ID.
    ; It is recommended that you put this function in an AdlibEnable, since it's EXTREMELY
    ; resource friendly.
    ;===============================================================================
    Func _HoverCheck()
    $HoverData = GUIGetCursorInfo($hOwnTabGui) ;modified by funkey for use with OwnTab-UDF
    If Not IsArray($HoverData) Then Return
    $Temp_Found = 0
    For $i = 1 To UBound($HoverArray) - 1
    If $HoverData[4] = $HoverArray[$i] Or $HoverData[4] = $HoverArray[$i] + 1 Then
    $Temp_Found = $i
    EndIf
    Next
    Select
    Case $Temp_Found = 0 And $HoverActive = 1 Or $Temp_Found <> 0 And $Temp_Found <> $Global_I And $HoverActive = 1
    $HoverActive = 0
    $Temp_Found = 0
    $szTemp_Array[0] = "LostHover"
    $szTemp_Array[1] = $HoverArray[$Global_I]
    Return $szTemp_Array
    Case $Temp_Found > 0 And $HoverActive = 0
    $Global_I = $Temp_Found
    $HoverActive = 1
    $Temp_Found = 0
    $szTemp_Array[0] = "AcquiredHover"
    $szTemp_Array[1] = $HoverArray[$Global_I]
    Return $szTemp_Array
    EndSelect
    EndFunc ;==>_HoverCheck
    #EndRegion _MouseHover.au3

    [/autoit]
  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 29. November 2009 um 12:53
    Zitat von blubbstar

    GuiCtrlCreateGraphic funktioniert irgendwie nicht, scheint so als würde es jedesmal wieder gehided werden ?¿? Komische Sache Flackert nämlich kurz auf beim Tabswitch.


    Danke für den Hinweis! Man kann kein Grafik-Element über ein farbiges Label legen, aber wenn der Hintergrund des OwnTabs die selbe Farbe wie der Gui-Hintergrund haben darf, dann kannst du einfach in der OwnTab-UDF in Zeile 60

    [autoit]

    GUICtrlSetBkColor(-1, $nColBg)

    [/autoit]

    durch

    [autoit]

    GUICtrlSetBkColor(-1, -2)

    [/autoit]

    ersetzen.

  • Doppelgeburtstag

    • funkey
    • 28. November 2009 um 13:48

    Auch ich wünsche euch beiden alles Gute zum Geburtstag!!
    Feiert schön, heute ist eh Samstag ;)

    [Blockierte Grafik: http://www.smilies.4-user.de/include/Grosse/smilie_gr_199.gif]

  • Geburtstag von Raupi

    • funkey
    • 26. November 2009 um 21:40

    Da ist ja auch ein Thread übrig für dich Raupi! :D

    Auch von mir noch einmal auf diesem Wege herzlichen Glückwunsch zum Geburtstag! :thumbup:

    Erst in einem Jahr öffnen!! Dann passt es nämlich genau!

    [Blockierte Grafik: http://www.morgenpost.de/multimedia/archive/00327/raupe_logo_zum_40___327863b.jpg]


    :rofl:

  • GUICtrlCreateGraphic, Tabs und der Refresh

    • funkey
    • 26. November 2009 um 16:31

    GuiCtrlCreateTabItem("") fehlte ;)

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ TestOhneTab()
    TestMitTabs()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Gui ohne Tabs
    Func TestOhneTab()

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $MyGuiWidth = 400
    Local Const $MyGuiHeight = 300
    Local Const $SignSize = 25
    Local $MySign1 = -1
    Local $MySign2 = -1
    Local $msg

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyGui = GUICreate("Test ohne Tab", $MyGuiWidth, $MyGuiHeight)

    [/autoit] [autoit][/autoit] [autoit]

    $MySign1 = GUICtrlCreateGraphic(50, 50, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00FF00, 0x00FF00)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)

    [/autoit] [autoit][/autoit] [autoit]

    $MySign2 = GUICtrlCreateGraphic(50, 100, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00FFFF, 0x00FFFF)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyTestButtonAdd = GUICtrlCreateButton("Add", $MyGuiWidth - 100, 50, 50, 20)

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyTestButtonDelete = GUICtrlCreateButton("Delete", $MyGuiWidth - 100, 100, 50, 20)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $MyGui)

    [/autoit] [autoit][/autoit] [autoit]

    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit]

    Switch $msg

    [/autoit] [autoit][/autoit] [autoit]

    Case $GUI_EVENT_CLOSE
    ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    Case $MyTestButtonDelete
    If $MySign1 == -1 Then
    MsgBox(16 + 262144, "Fehler", "Signs sind bereits gelöscht!")
    Else
    GUICtrlDelete($MySign1)
    $MySign1 = -1
    GUICtrlDelete($MySign2)
    $MySign2 = -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $MyTestButtonAdd
    If $MySign1 == -1 Then
    $MySign1 = GUICtrlCreateGraphic(50, 50, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00FF00, 0x00FF00)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)

    [/autoit] [autoit][/autoit] [autoit]

    $MySign2 = GUICtrlCreateGraphic(50, 100, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00FFFF, 0x00FFFF)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
    Else
    MsgBox(16 + 262144, "Fehler", "Signs sind bereits da!")
    EndIf
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    GUIDelete($MyGui)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>TestOhneTab

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Gui mit Tabs
    Func TestMitTabs()

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $MyGuiWidth = 400
    Local Const $MyGuiHeight = 300
    Local Const $SignSize = 15
    Local $MySign1 = -1
    Local $MySign2 = -1
    Local $msg

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyGui = GUICreate("Test mit Tabs", $MyGuiWidth, $MyGuiHeight)

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyTabs = GUICtrlCreateTab(0, 0, $MyGuiWidth - 10, $MyGuiHeight - 10)

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyTabOne = GUICtrlCreateTabItem("Tab 1")

    [/autoit] [autoit][/autoit] [autoit]

    $MySign1 = GUICtrlCreateGraphic(50, 50, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00FF00, 0x00FF00)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
    GUICtrlSetState(-1, $GUI_ONTOP) ; <--

    [/autoit] [autoit][/autoit] [autoit]

    $MySign2 = GUICtrlCreateGraphic(50, 100, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00FFFF, 0x00FFFF)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
    GUICtrlSetState(-1, $GUI_ONTOP) ; <--

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyTestButtonAdd = GUICtrlCreateButton("Add", $MyGuiWidth - 100, 50, 50, 20)

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyTestButtonDelete = GUICtrlCreateButton("Delete", $MyGuiWidth - 100, 100, 50, 20)

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyTabTwo = GUICtrlCreateTabItem("Tab 2")

    [/autoit] [autoit][/autoit] [autoit]

    Local $MyTestButtonClose = GUICtrlCreateButton("Close", $MyGuiWidth - 150, $MyGuiHeight - 150, 50, 20)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateTabItem("") ; close tabitem creation

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $MyGui)

    [/autoit] [autoit][/autoit] [autoit]

    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit]

    Switch $msg

    [/autoit] [autoit][/autoit] [autoit]

    Case $GUI_EVENT_CLOSE, $MyTestButtonClose
    ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    Case $MyTestButtonDelete
    If $MySign1 == -1 Then
    MsgBox(16 + 262144, "Fehler", "Signs sind bereits gelöscht!")
    Else
    ; GUISwitch($MyGui, $MyTabs)
    GUISwitch($MyGui, $MyTabOne)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlDelete($MySign1)
    $MySign1 = -1
    GUICtrlDelete($MySign2)
    $MySign2 = -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $MyTestButtonAdd
    If $MySign1 == -1 Then
    ; GUISwitch($MyGui, $MyTabs)
    GUISwitch($MyGui, $MyTabOne)

    [/autoit] [autoit][/autoit] [autoit]

    $MySign1 = GUICtrlCreateGraphic(50, 50, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00FF00, 0x00FF00)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
    GUICtrlSetState(-1, $GUI_ONTOP) ; <--

    [/autoit] [autoit][/autoit] [autoit]

    $MySign2 = GUICtrlCreateGraphic(50, 100, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00FFFF, 0x00FFFF)
    GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, $SignSize, $SignSize)
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
    GUICtrlSetState(-1, $GUI_ONTOP) ; <--

    GuiCtrlCreateTabItem("") ; <--- hier ;)

    [/autoit] [autoit][/autoit] [autoit]

    ; GUISetState(@SW_SHOW, $MyGui)
    Else
    MsgBox(16 + 262144, "Fehler", "Signs sind bereits da!")
    EndIf
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    GUIDelete($MyGui)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>TestMitTabs

    [/autoit]
  • String Zeichen Löschen/Editieren (String Glätten)

    • funkey
    • 26. November 2009 um 12:40
    [autoit]

    StringStripWS

    [/autoit]

    ?

  • COM idl tutorial

    • funkey
    • 26. November 2009 um 12:30

    Hab da zwar keine Ahnung, aber das habe ich zumindest gefunden.

    [ gelöst ] AutoitX dispinterface

    Vllt hilft dir das weiter.

  • AutoIt BETA

    • funkey
    • 24. November 2009 um 21:09

    Version 3.3.1.6 gibt's jetzt schon länger als 24h. Funktioniert es noch nicht, oder ist der Ausfall von autoitscript.com Schuld?

  • Pixel in cm?

    • funkey
    • 24. November 2009 um 18:53

    Das könnte auch helfen: [ offen ] "Maus-O-Meter"

  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 24. November 2009 um 18:38
    Zitat von DeepRed92

    ich finde, dass Deine UDF immer besser und besser wird :rock:


    Danke!!

    Zu dem Problem kommt es, da in meinem Beispiel die Styles gemischt sind. Normalerweise ist das ja nicht der Fall. Werde es aber versuchen zu beheben.

  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 24. November 2009 um 17:23

    Danke für das Feedback SeuBo!!

    Jetzt sind alle bekannten Bugs beseitigt. Läuft tadellos.
    Neue Version siehe Post#1!

    Bitte um weiteres Feedback. Danke!

  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 23. November 2009 um 16:51

    Neue Version!!

    * Blinken des alarmierten Registers hinzugefügt (war gar nicht so leicht)
    * verstecken und anzeigen von Registern (war auch gar nicht so leicht)

    Hoffentlich haben sich auch ein paar Bugs verflüchtigt.

  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 20. November 2009 um 17:35

    Verstecken und wieder anzeigen ist ein bischen schwieriger, aber ohne weiteres machbar. Ich glaube nicht, dass ich heute noch Zeit habe, aber spätestens bis Anfang nächster Woche werde ich 2 passende Funktionen dafür geschrieben haben.

  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 19. November 2009 um 20:12

    Neue Funktionen!!
    Vorerst nur im Beispiel-Skript

    * Schriftfarbe der Register ändern
    * Einzelne Register deaktivieren

    Spoiler anzeigen
    [autoit]

    #include "OwnTab.au3"

    [/autoit] [autoit][/autoit] [autoit]

    Local $hGui = GUICreate("Funkey's OwnTab-UDF Example", 500, 350)
    GUISetBkColor(0xbbbbbb)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aTabText[4] = ["Item 1", "Register without icon", "Pic", "Status"] ;Declare the regions for the OwnTab-control
    Local $aTabIcons[4][2] = [["shell32.dll", Random(1, 234, 1)],[""],["shell32.dll", Random(1, 234, 1)], ["shell32.dll", Random(1, 234, 1)]]
    Global $aCtrlTab = _OwnTab_Create($hGui, $aTabText, 10, 10, 480, 300, 30, 0xD5D5D5, 0xCFE0E7, 0xCFE0E7, $aTabIcons)

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab1
    _OwnTab_Add($aCtrlTab) ;Start controls tab1
    Global $Edit1 = GUICtrlCreateEdit("Edit in Tab1", 20, 55, 300, 50, 0)
    Global $Button1 = GUICtrlCreateButton("Simulate an alarm", 20, 120, 300, 20)
    Global $Box1 = GUICtrlCreateCheckbox("Switch on hover", 20, 180)
    GUICtrlSetBkColor(-1, 0xCFE0E7)
    #EndRegion Tab1

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab2
    _OwnTab_Add($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

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab3
    _OwnTab_Add($aCtrlTab) ;Start controls tab3
    Global $Edit3 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 20, 55, 460, 280)
    #EndRegion Tab3

    [/autoit] [autoit][/autoit] [autoit]

    #Region Tab4
    _OwnTab_Add($aCtrlTab) ;Start controls tab4
    Global $Button4 = GUICtrlCreateButton("Acknowledge the alarm", 20, 120, 300, 20)
    Global $Button5 = GUICtrlCreateButton("Enable tab 3", 20, 150, 300, 20)
    Global $Button6 = GUICtrlCreateButton("Disable tab 3", 20, 180, 300, 20)
    #EndRegion Tab4

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_End($aCtrlTab)
    _OwnTab_Switch($aCtrlTab, 1) ;inizialize the OwnTab
    _OwnTab_Disable($aCtrlTab, 3)
    _OwnTab_SetFontCol($aCtrlTab, 0xFF)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _OwnTab_Hover($aCtrlTab, 0xFFFF88, 0) ;start hover-function if you want

    [/autoit] [autoit][/autoit] [autoit]

    Local $msg
    Do
    $msg = GUIGetMsg()
    For $a = 1 To UBound($aCtrlTab, 1) - 1
    If $msg = $aCtrlTab[$a][0] Then
    _OwnTab_Switch($aCtrlTab, $a)
    EndIf
    Next
    If $msg = $Button1 Then _OwnTab_SetAlarm($aCtrlTab, 4, 0xFF0000, 0xFF0000)
    If $msg = $Button4 Then _OwnTab_ResetAlarm($aCtrlTab, 4)
    If $msg = $Button5 Then _OwnTab_Enable($aCtrlTab, 3)
    If $msg = $Button6 Then _OwnTab_Disable($aCtrlTab, 3)
    If $msg = $Box1 Then
    If GUICtrlRead($Box1) = 1 Then
    _OwnTab_Hover($aCtrlTab, 0xFFFF88, 15)
    Else
    _OwnTab_Hover($aCtrlTab, 0xFFFF88, 0)
    EndIf
    EndIf
    Sleep(10)
    Until $msg = -3

    [/autoit] [autoit][/autoit] [autoit]

    #Region Disable and Enable Tab-Register
    Func _OwnTab_Disable($aOwnTab, $iIndex)
    GUICtrlSetState($aOwnTab[$iIndex][0], 128)
    _OwnTab_UnRegisterHover($aOwnTab, $iIndex)
    Local $iSearch = _ArraySearch($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
    If $iSearch = -1 Then _ArrayAdd($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_Enable($aOwnTab, $iIndex)
    GUICtrlSetState($aOwnTab[$iIndex][0], 64)
    _OwnTab_RegisterHover($aOwnTab, $iIndex)
    Local $iSearch = _ArraySearch($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
    If $iSearch <> -1 Then _ArrayDelete($OwnTabHoverHelp, $iSearch)
    EndFunc
    #EndRegion Disable and Enable Tab-Register

    [/autoit] [autoit][/autoit] [autoit]

    Func _OwnTab_SetFontCol($aOwnTab, $nColor)
    For $i = 1 To UBound($aOwnTab, 1) - 1
    GUICtrlSetColor($aOwnTab[$i][0], $nColor)
    Next
    EndFunc

    [/autoit]
  • Erweiterung für den 'Send' Befehl

    • funkey
    • 19. November 2009 um 18:33
    [autoit]

    ControlSend
    ControlSetText

    [/autoit]
  • Gui-Menü Schriftgröße vergrößern

    • funkey
    • 19. November 2009 um 18:13

    Ich hätte da eine Lösung gebastelt, aber es gibt bestimmt auch eine bessere. ;)

    Spoiler anzeigen
    [autoit]

    #cs **************************************************************************

    [/autoit] [autoit][/autoit] [autoit]

    Menü überall platzieren

    [/autoit] [autoit][/autoit] [autoit]

    http://www.autoit.de/index.php?page…0614#post110614

    [/autoit] [autoit][/autoit] [autoit]

    #ce **************************************************************************

    [/autoit] [autoit][/autoit] [autoit]

    Opt('GUIOnEventMode', 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hGui = GUICreate("Mein eigenes Menü", 270, 140, -1, -1);, 0x80000000)
    GUISetOnEvent(-3, '_Exit')

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $MenueDatei = GUICtrlCreateLabel('&Datei', 0, 0, 80, 30, 0x201)
    GUICtrlSetOnEvent(-1, '_MenuPressed')
    GUICtrlSetFont(-1, 20)

    [/autoit] [autoit][/autoit] [autoit]

    $DateiContext = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
    $OptionsOpen = GUICtrlCreateMenuItem("Ö&ffnen", $DateiContext)
    $OptionsClose = GUICtrlCreateMenuItem("S&chließen", $DateiContext)
    GUICtrlCreateMenuItem("", $DateiContext)
    $OptionsExit = GUICtrlCreateMenuItem("B&eenden", $DateiContext)
    GUICtrlSetOnEvent(-1, '_Exit')

    [/autoit] [autoit][/autoit] [autoit]

    $MenueHelp = GUICtrlCreateLabel("&Hilfe", 80, 0, 80, 30, 0x201)
    GUICtrlSetOnEvent(-1, '_MenuPressed')
    GUICtrlSetFont(-1, 20)

    [/autoit] [autoit][/autoit] [autoit]

    $HelpContext = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
    $HelpWWW = GUICtrlCreateMenuItem("&Website", $HelpContext)
    GUICtrlSetOnEvent(-1, '_Website')
    GUICtrlCreateMenuItem("", $HelpContext)
    $HelpAbout = GUICtrlCreateMenuItem("Ü&ber...", $HelpContext)
    GUICtrlSetOnEvent(-1, '_About')

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel('', 0, 30, 270, 2, 0x1000)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    Global $AccelKeys[2][2]=[["!d", $MenueDatei], ["!h", $MenueHelp]]
    GUISetAccelerators($AccelKeys)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(10000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MenuPressed()
    Switch @GUI_CtrlId
    Case $MenueDatei
    ShowMenu($hGui, $MenueDatei, $DateiContext)
    Case $MenueHelp
    ShowMenu($hGui, $MenueHelp, $HelpContext)
    EndSwitch
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _About()
    MsgBox(64, "About...", "Beispiel für ein eigenes Menü")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Website()
    MsgBox(64, "Website...", "www.autoit.de")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; Show a menu in a given GUI window which belongs to a given GUI ctrl
    Func ShowMenu($hWnd, $CtrlID, $nContextID)
    Local $arPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($nContextID)

    [/autoit] [autoit][/autoit] [autoit]

    $arPos = ControlGetPos($hWnd, "", $CtrlID)

    [/autoit] [autoit][/autoit] [autoit]

    $x = $arPos[0]
    $y = $arPos[1] + $arPos[3]

    [/autoit] [autoit][/autoit] [autoit]

    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)
    EndFunc ;==>ShowMenu

    [/autoit] [autoit][/autoit] [autoit]

    ; Convert the client (GUI) coordinates to screen (desktop) coordinates
    Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $stPoint = DllStructCreate("int;int")

    [/autoit] [autoit][/autoit] [autoit]

    DllStructSetData($stPoint, 1, $x)
    DllStructSetData($stPoint, 2, $y)

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))

    [/autoit] [autoit][/autoit] [autoit]

    $x = DllStructGetData($stPoint, 1)
    $y = DllStructGetData($stPoint, 2)
    ; release Struct not really needed as it is a local
    $stPoint = 0
    EndFunc ;==>ClientToScreen

    [/autoit] [autoit][/autoit] [autoit]

    ; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd)
    Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
    EndFunc ;==>TrackPopupMenu

    [/autoit]
  • Eigenes Tab-Register (OwnTab-UDF)

    • funkey
    • 18. November 2009 um 17:32

    Danke Oscar und Zacharja!! 8)

    Zitat von Zacharja

    Wenn man Switch on Hover aktiviert hat, kann man nicht auf ein alarmiertes Tab wechseln...


    Diese Einschränkung ist mir (neben anderen) schon bekannt, aber man kann einfach nicht immer alles haben ;)
    Vllt fällt mir mal eine Lösung ein, wie das einfach zu bewerkstelligen ist.


    Screenshot im ersten Post ergänzt.

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™