scrollbare GUI

  • Hi,

    weiss eine wie ich ne GUI mit Scrollbalken erstellen kann?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    AutoitSetOption("GUIResizeMode",802) ; bei Größenänderung der GUI, bleiben die Elemente unverändert
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 318, 172, 193, 125, $WS_SIZEBOX)
    $Label1 = GUICtrlCreateLabel("Label1", 32, 32, 36, 17)
    $Input1 = GUICtrlCreateInput("Input1", 328, 328, 137, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]

    PS: GUI größerziehen dann erscheint noch ein Element


    Danke ;)

  • Carsten8

    habe ich schon probiert, er erscheint auch, jedoch kann ich nicht scrollen


    @pee

    danke, so was hab ich gesucht

    leider funktioniert es nicht so richtig.

    Einfach mal das Fenster größerziehen und dei Scrollbalken beobeachten

    Spoiler anzeigen
    [autoit]

    #include<GUIConstants.au3>
    #include<GUIScrollBars.au3>
    AutoitSetOption("GUIResizeMode",802) ; bei Größenänderung der GUI, bleiben die Elemente unverändert

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

    $Form1 = GUICreate("Form1", 930, 900, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
    _GUIScrollBars_Init ($Form1)
    GUIRegisterMsg($WM_VSCROLL, "MY_WM_VSCROLL")
    GUIRegisterMsg($WM_HSCROLL, "MY_WM_HSCROLL")
    GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")
    $Label1 = GUICtrlCreateLabel("Label1", 32, 32, 36, 17)
    $Input1 = GUICtrlCreateInput("Input1", 900, 870, 30, 30)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]
  • Danke Fintan,

    dies ist jedoch der gleiche Link der mir peethebee gepostet hat ;)

    Trotzdem danke :D

    EDIT: Hab im englischen Forum nachgefragt.

    So klappt es

    Spoiler anzeigen
    [autoit]

    #include<GUIConstants.au3>
    #include<GUIScrollBars.au3>
    AutoitSetOption("GUIResizeMode",802); bei Größenänderung der GUI, bleiben die Elemente unverändert

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

    $Form1 = GUICreate("Form1", 930, 900, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
    WinMove("Form1", "", -1, -1, 931, 901)
    _GUIScrollBars_Init ($Form1, 930, 60)
    GUIRegisterMsg($WM_VSCROLL, "MY_WM_VSCROLL")
    GUIRegisterMsg($WM_HSCROLL, "MY_WM_HSCROLL")
    GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")

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

    $Label1 = GUICtrlCreateLabel("Label1", 32, 32, 36, 17)
    $Input1 = GUICtrlCreateInput("Input1", 900, 870, 30, 30)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]

    Bei "_GUIScrollBars_Init ($Form1, 930, 60)" muß man spielen, damit die Scroll-Balken auch zum richtigen Zeitpunkt da sind :rock:

  • Hallo

    Ich benötige auch die Funktion um eine Scrollbare GUI erstellen zu können, allerdings ist nirgends mehr die GUIScrollbar.au3 verfügbar und ohne die geht leider nichts.

    Hat die noch jemand und könnte mir den Quelltext posten?


    Gruß
    dragst3r

  • Bitte schön :)

    GUIScrollBars.au3
    [autoit]


    #include-once
    #include <WinAPI.au3>

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

    Global Const $Debug = 1

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

    Global Const $SIF_POS = 0x4
    Global Const $SIF_PAGE = 0x2
    Global Const $SIF_RANGE = 0x1
    Global Const $SIF_TRACKPOS = 0x10
    Global Const $SIF_ALL = BitOR($SIF_RANGE, $SIF_PAGE, $SIF_POS, $SIF_TRACKPOS)

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

    Global Const $SB_HORZ = 0
    Global Const $SB_VERT = 1
    Global Const $SB_CTL = 2
    Global Const $SB_BOTH = 3

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

    Global Const $SB_LINELEFT = 0
    Global Const $SB_LINERIGHT = 1
    Global Const $SB_PAGELEFT = 2
    Global Const $SB_PAGERIGHT = 3
    Global Const $SB_LINEUP = 0
    Global Const $SB_LINEDOWN = 1
    Global Const $SB_PAGEUP = 2
    Global Const $SB_PAGEDOWN = 3
    Global Const $SB_TOP = 6
    Global Const $SB_BOTTOM = 7

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

    ;0 = hwnd;1 = xClientMax;2 cxChar;3 = cyChar;4 cxClient;5 = cyClient,6 = iHMax;7 = iVMax
    Global $aSB_WindowInfo[1][8]

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

    Global Const $tagSCROLLINFO = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"

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

    Global Const $tagTEXTMETRIC = "long tmHeight;long tmAscent;long tmDescent;long tmInternalLeading;long tmExternalLeading;" & _
    "long tmAveCharWidth;long tmMaxCharWidth;long tmWeight;long tmOverhang;long tmDigitizedAspectX;long tmDigitizedAspectY;" & _
    "char tmFirstChar;char tmLastChar;char tmDefaultChar;char tmBreakChar;byte tmItalic;byte tmUnderlined;byte tmStruckOut;" & _
    "byte tmPitchAndFamily;byte tmCharSet"

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

    Func _GUIScrollBars_Init($hWnd, $iHMax = -1, $ivMax = -1)
    If Not IsHWnd($hWnd) Then WinGetHandle($hWnd)
    If $aSB_WindowInfo[0][0] <> 0 Then ReDim $aSB_WindowInfo[UBound($aSB_WindowInfo) + 1][8]

    Local $xChar, $yChar, $index, $wpos, $hdc, $tTEXTMETRIC
    Local $xUpper
    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    $index = UBound($aSB_WindowInfo) - 1
    ;~ $wpos = WinGetPos($hwnd)

    _DebugPrint("index: " & $index)
    $aSB_WindowInfo[$index][0] = $hWnd
    $aSB_WindowInfo[$index][1] = $iHMax
    $aSB_WindowInfo[$index][6] = $iHMax
    $aSB_WindowInfo[$index][7] = $ivMax
    If $ivMax = -1 Then $aSB_WindowInfo[$index][7] = 27

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

    $hdc = _WinAPI_GetDC ($hWnd)

    $tTEXTMETRIC = DllStructCreate($tagTEXTMETRIC)

    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))

    DllCall("gdi32.dll", "int", "GetTextMetrics", "int", $hdc, "ptr", DllStructGetPtr($tTEXTMETRIC))
    $xChar = DllStructGetData($tTEXTMETRIC, "tmAveCharWidth")
    If $Debug Then _DebugPrint("$xChar: " & $xChar)
    If BitAND(DllStructGetData($tTEXTMETRIC, "tmPitchAndFamily"), 1) Then
    $xUpper = 3 * $xChar / 2
    Else
    $xUpper = 2 * $xChar / 2
    EndIf

    If $Debug Then _DebugPrint("$xUpper: " & $xUpper)
    $yChar = DllStructGetData($tTEXTMETRIC, "tmHeight") + DllStructGetData($tTEXTMETRIC, "tmExternalLeading")
    If $Debug Then _DebugPrint("$yChar: " & $yChar)
    _WinAPI_ReleaseDC ($hWnd, $hdc)
    If $iHMax = -1 Then $aSB_WindowInfo[$index][1] = 48 * $xChar + 12 * $xUpper
    If $Debug Then _DebugPrint("$xClientMax: " & $aSB_WindowInfo[$index][1])
    $aSB_WindowInfo[$index][2] = $xChar
    $aSB_WindowInfo[$index][3] = $yChar

    _GUIScrollBars_Show($hWnd, $SB_HORZ, False)
    _GUIScrollBars_Show($hWnd, $SB_VERT, False)
    _GUIScrollBars_Show($hWnd, $SB_HORZ)
    _GUIScrollBars_Show($hWnd, $SB_VERT)

    EndFunc ;==>_GUIScrollBars_Init

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

    Func MY_WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $xClient, $yClient
    Local $ivMax, $aRet
    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xClientMax = $aSB_WindowInfo[$index][1]
    $xChar = $aSB_WindowInfo[$index][2]
    $yChar = $aSB_WindowInfo[$index][3]
    $ivMax = $aSB_WindowInfo[$index][7]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    $aRet = DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $SB_VERT, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)

    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    $aRet = DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)

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

    Return $GUI_RUNDEFMSG
    EndFunc ;==>MY_WM_SIZE

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

    Func MY_WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $hwndScrollBar = HWnd($lParam)
    If $Debug Then _DebugPrint($nScrollCode & ";" & BitShift($wParam, 16) & ";" & $hwndScrollBar)

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

    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $xPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xChar = $aSB_WindowInfo[$index][2]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

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

    ; Get all the horizontal scroll bar information
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO))
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $xPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $xPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $Min, $Max
    Switch $nScrollCode

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

    Case $SB_LINELEFT ; user clicked left arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

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

    Case $SB_LINERIGHT ; user clicked right arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

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

    Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

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

    Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

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

    Case $SB_THUMBTRACK ; user dragged the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

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

    ;~ // Set the position and then retrieve it. Due to adjustments
    ;~ // by Windows it may not be the same as the value set.

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO))
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $xPos) Then DllCall("user32.dll", "int", "ScrollWindow", "hwnd", $hWnd, "int", $xChar * ($xPos - $Pos), "int", 0, "ptr", 0, "ptr", 0)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>MY_WM_HSCROLL

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

    Func MY_WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $hwndScrollBar = HWnd($lParam)
    If $Debug Then _DebugPrint($nScrollCode & ";" & BitShift($wParam, 16) & ";" & $hwndScrollBar)
    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $yChar = $aSB_WindowInfo[$index][3]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

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

    ; Get all the vertial scroll bar information
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_VERT, "ptr", DllStructGetPtr($tSCROLLINFO))
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

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

    Switch $nScrollCode
    Case $SB_TOP ; user clicked the HOME keyboard key
    DllStructSetData($tSCROLLINFO, "nPos", $Min)

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

    Case $SB_BOTTOM ; user clicked the END keyboard key
    DllStructSetData($tSCROLLINFO, "nPos", $Max)

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

    Case $SB_LINEUP ; user clicked the top arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

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

    Case $SB_LINEDOWN ; user clicked the bottom arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

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

    Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

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

    Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

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

    Case $SB_THUMBTRACK ; user dragged the scroll box
    DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch
    ;~ // Set the position and then retrieve it. Due to adjustments
    ;~ // by Windows it may not be the same as the value set.

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $SB_VERT, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_VERT, "ptr", DllStructGetPtr($tSCROLLINFO))
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

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

    If ($Pos <> $yPos) Then
    DllCall("user32.dll", "int", "ScrollWindow", "hwnd", $hWnd, "int", 0, "int", $yChar * ($yPos - $Pos), "ptr", 0, "ptr", 0)
    $yPos = $Pos
    EndIf

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

    Return $GUI_RUNDEFMSG

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

    EndFunc ;==>MY_WM_VSCROLL

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

    Func _GUIScrollBars_Enable($hWnd, $wBar, $enable = True)
    Local Const $SIF_DISABLENOSCROLL = 0x8

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

    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $xClient, $yClient

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xClientMax = $aSB_WindowInfo[$index][1]
    $xChar = $aSB_WindowInfo[$index][2]
    $yChar = $aSB_WindowInfo[$index][3]
    $xClient = $aSB_WindowInfo[$index][4]
    $yClient = $aSB_WindowInfo[$index][5]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

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

    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $SB_HORZ, "ptr", DllStructGetPtr($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_DISABLENOSCROLL, $SIF_ALL))
    DllStructSetData($tSCROLLINFO, "nMax", 0)
    If $wBar = $SB_HORZ Then
    If $enable Then
    DllStructSetData($tSCROLLINFO, "nMax", $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    EndIf
    Else
    If $enable Then
    DllStructSetData($tSCROLLINFO, "nMax", 27) ; max
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    EndIf
    EndIf
    DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $wBar, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)
    EndFunc ;==>_GUIScrollBars_Enable

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

    Func _GUIScrollBars_Show($hWnd, $wBar, $Show = True)
    Local $v_ret = DllCall("user32.dll", "int", "ShowScrollBar", "hwnd", $hWnd, "int", $wBar, "int", $Show)
    If @error Or Not IsArray($v_ret) Then Return SetError(-1, -1, -1)
    Return $v_ret[0]
    EndFunc ;==>_GUIScrollBars_Show

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

    Func _GUIScrollBars_SetPos($hWnd, $wBar, $Pos)
    Local $index = -1, $m_height, $m_width, $c_top, $c_height, $yChar, $xChar, $xClientMax, $xyPos

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

    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xChar = $aSB_WindowInfo[$index][2]
    $yChar = $aSB_WindowInfo[$index][3]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

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

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

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

    ; Save the position for comparison later on
    DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
    DllStructSetData($tSCROLLINFO, "fMask", $SIF_ALL)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $wBar, "ptr", DllStructGetPtr($tSCROLLINFO))
    $xyPos = DllStructGetData($tSCROLLINFO, "nPos")

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    DllStructSetData($tSCROLLINFO, "nPos", $Pos)
    DllCall("user32.dll", "int", "SetScrollInfo", "hwnd", $hWnd, "int", $wBar, "ptr", DllStructGetPtr($tSCROLLINFO), "int", True)
    DllCall("user32.dll", "int", "GetScrollInfo", "hwnd", $hWnd, "int", $wBar, "ptr", DllStructGetPtr($tSCROLLINFO))
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If $wBar = $SB_HORZ Then
    If ($Pos <> $xyPos) Then DllCall("user32.dll", "int", "ScrollWindow", "hwnd", $hWnd, "int", $xChar * ($xyPos - $Pos), "int", 0, "ptr", 0, "ptr", 0)
    Else
    If ($Pos <> $xyPos) Then DllCall("user32.dll", "int", "ScrollWindow", "hwnd", $hWnd, "int", 0, "int", $yChar * ($xyPos - $Pos), "ptr", 0, "ptr", 0)
    EndIf
    EndFunc ;==>_GUIScrollBars_SetPos

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

    Func _GUIScrollBars_SetRange($hWnd, $nBar, $nMinPos, $nMaxPos)
    Local $v_ret = DllCall("user32.dll", "int", "SetScrollRange", "hwnd", $hWnd, "int", $nBar, "int", $nMinPos, "int", $nMaxPos, "int", True)
    If @error Or Not IsArray($v_ret) Then Return SetError(-1, -1, -1)
    Return $v_ret[0]
    EndFunc ;==>_GUIScrollBars_SetRange

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

    Func _GUIScrollBars_GetRange($hWnd, $nBar)
    Local $lpMin = DllStructCreate("int")
    Local $lpMax = DllStructCreate("int")
    Local $v_ret = DllCall("user32.dll", "int", "GetScrollRange", "hwnd", $hWnd, "int", $nBar, "ptr", DllStructGetPtr($lpMin), "ptr", DllStructGetPtr($lpMax))
    If @error Or Not IsArray($v_ret) Then Return SetError(-1, -1, -1)
    Local $Min_Max[2]
    $Min_Max[0] = DllStructGetData($lpMin, 1)
    $Min_Max[1] = DllStructGetData($lpMax, 1)
    Return $Min_Max
    EndFunc ;==>_GUIScrollBars_GetRange

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

    Func _DebugPrint($s_text)
    $s_text = StringReplace($s_text, @LF, @LF & "-->")
    ConsoleWrite("!===========================================================" & @LF & _
    "+===========================================================" & @LF & _
    "-->" & $s_text & @LF & _
    "+===========================================================" & @LF)
    EndFunc ;==>_DebugPrint

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

    Mfg
    Jens (McPoldy)

    Twitter: jkroeger

    Denn die Dinge, die wir erst lernen müssen, bevor wir sie tun, lernen wir beim Tun.(Aristoteles)

  • Die heißen z.B.
    _GUIScrollBars_EnableScrollBar
    include ist #Include <GuiScrollBars.au3>
    ABER NUR IN DER BETA NICHT DER STABLE!

  • Gibt es die Möglichkeit den Scrollbalken wieder an höchster Stelle zu schieben, weil bei mir gibt es ein Problem und zwar wenn ich den Scrollbalken nach unten bewege und durch refresh der GUI ein paar Icons mit SetImage ändere, diese alle verschoben sind, je nach dem wo der Scrollbalken steht. Wenn ich allerdings SetData von Checkboxen in dieser Scrollbare GUI mache, ändern sich die Koordinaten nicht!!!!

    Mithilfe von _GUIScrollBars_SetPos() habe ich schon was versucht, aber nicht geschafft.
    Kann mir da einer einen Tip geben???


    EDIT: Es funktioniert nun, hatte ausversehen die falsche GUI angegeben. Ohh mann :wacko: :wacko:

    Einmal editiert, zuletzt von dragst3r (22. Februar 2008 um 08:27)