Jump to content

Scrollbars Made Easy - New version 27 Jan 22


Melba23
 Share

Recommended Posts

  • Moderators

tatane,

Using _GUIScrollbars_Restore to reset the scrollbars is indeed the right way - that is why the function is there!

Quote

Could you have a look at the commented stuff please

I wondered when you would get round to that!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

tatane,

I have not even looked at the code yet - be patient!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

tatane,

The buttons seems to work well - if you disable the label so that they fire and use the correct maths to regenerate the scrollbars:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <GUIScrollbars_Ex_Test.au3>

Global $iGUI_1_MinX = 300, $iGUI_1_MinY = 200
Global $iGUI_1_MaxX, $iGUI_1_MaxY

Global $diviseur = 1

Local $iMax_Scroll = 600

Local $hGUI = GUICreate("Resizeable Test ", 400, 400, Default, Default, $WS_SIZEBOX)
GUISetBkColor(0xCCFFCC)

Local $cStart = GUICtrlCreateDummy()
GUICtrlCreateLabel("", 0, 0, $iMax_Scroll, $iMax_Scroll)
GUICtrlSetBkColor(-1, 0xFFCCCC)
GUICtrlSetState(-1, $GUI_DISABLE) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< So buttons work
GUICtrlCreateLabel("Use me to check that the scrolled position" & @CRLF & "is maintained if possible during resizing", 50, 50, 300, 50)
GUICtrlSetBkColor(-1, 0xCCCCFF)
GUICtrlCreateLabel("", 0, 0, 10, 10)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlCreateLabel("", 0, $iMax_Scroll- 10, 10, 10)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlCreateLabel("", $iMax_Scroll - 10, 0, 10, 10)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlCreateLabel("", 590, 590, 10, 10)
GUICtrlSetBkColor(-1, 0xFF0000)
Local $cEnd = GUICtrlCreateDummy()
For $i = $cStart To $cEnd
    GUICtrlSetResizing($i, $GUI_DOCKALL)
Next
$b_testminus = GUICtrlCreateButton("zoom -", 5, 5)
$b_testplus = GUICtrlCreateButton("zoom +", 55, 5)

; Generate initial scrollbars - required scrollbar handlers registered
_GUIScrollbars_Generate($hGUI, $iMax_Scroll, $iMax_Scroll)
; Intialise for resizing
Local $aMaxSize = _GUIScrollbars_ReSizer($hGUI, $iMax_Scroll, $iMax_Scroll, False)

GUISetState(@SW_SHOW)

$iGUI_1_MaxX = $aMaxSize[0]
$iGUI_1_MaxY = $aMaxSize[1]

ConsoleWrite("Max Size: " & $iGUI_1_MaxX & " - " & $iGUI_1_MaxY & @CRLF)

GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO")

While 1
    $nmsg = GUIGetMsg()
    Switch $nmsg
        Case $b_testplus
            $diviseur = $diviseur * 2
            ConsoleWrite('Plus - $diviseur = ' & $diviseur & @CRLF)
            _GUIScrollbars_Generate($hGUI, $iMax_Scroll * $diviseur, $iMax_Scroll * $diviseur)

        Case $b_testminus
            If $diviseur > 1 Then
                $diviseur = $diviseur / 2
                ConsoleWrite('Minus - $diviseur = ' & $diviseur & @CRLF)
                _GUIScrollbars_Generate($hGUI, $iMax_Scroll * $diviseur, $iMax_Scroll * $diviseur) ; Note using * and not /
            EndIf

        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    ;Sleep(10) ; <<<<<<<<<<<<<<<<<<<<<< Not needed with GUIGetMsg
WEnd

GUIRegisterMsg($WM_GETMINMAXINFO, "")
GUIDelete($hGUI)


Func _WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
    Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $iGUI_1_MinX)  ; min X
    DllStructSetData($tagMaxinfo, 8, $iGUI_1_MinY)   ; min Y
    DllStructSetData($tagMaxinfo, 9, $iGUI_1_MaxX) ; max X
    DllStructSetData($tagMaxinfo, 10, $iGUI_1_MaxY) ; max Y
    Return 0
EndFunc   ;==>_WM_GETMINMAXINFO

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thank you Melba23.

Just a last thing. When your start the script, enlarge at max the GUI, zoom+ one or several time, then zoom- to get back to $diviseur = 1, the scrollbars stay visible. They should be hide. If I hide them manually, it works but i can still scroll while it is at max size.

Edited by tatane
Link to comment
Share on other sites

  • Moderators

tatane,

Try amending the script like this:

Case $b_testminus
    If $diviseur > 1 Then
        $diviseur = $diviseur / 2
        ConsoleWrite('Minus - $diviseur = ' & $diviseur & @CRLF)
        _GUIScrollbars_Generate($hGUI, $iMax_Scroll * $diviseur, $iMax_Scroll * $diviseur) ; Note using * and not /
        If $diviseur = 1 Then
            _GUIScrollbars_ReSizer($hGUI, $iMax_Scroll, $iMax_Scroll, True, False)
        EndIf
    EndIf

That cures the problem  as far as I can see.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

tatane,

I think you are trying to do too much with the Scrollbars_Ex  UDF. As I mentioned above, trying to program scrollbars in resizable GUIs is the hardest thing I have ever tried to do in AutoIt given the amount of "behind the scenes" stuff Windows does when resizing and hiding/showing scrollbars - the client area size changes, the main content changes magnification to fit into the new sized area, etc, etc. Further testing of the changes that I made in the Beta code above has shown me that they could already lead to problems in other circumstances, so I am not prepared to incorporate them - let alone make further alterations.

However, I think we might be able to do something with the Scrollbars_Size UDF - I will see what I can come up with as an example over the next few days.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

tatane,

Not as difficult as I imagined - take a look at this:

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

Global $iMag = 1
Global $iMax_HScroll = 600, $iMax_VScroll = 600
Global $iGUI_MinX = 200, $iGUI_MinY = 200
Global $iGUI_MaxX = 600, $iGUI_MaxY = 600

Global $iVSize = _WinAPI_GetSystemMetrics(2) ; Width of VScrollbar:  SM_CXVSCROLL
Global $iHSize = _WinAPI_GetSystemMetrics(3) ; Height of HScrollbar: SM_CYHSCROLL
Global $iH_Pos, $iV_Pos

Global $aLabels[5]

$hGUI = GUICreate("Resizeable Test - Mag: 1", 400, 400, Default, Default, $WS_SIZEBOX)
GUISetBkColor(0xCCFFCC)

Local $cStart = GUICtrlCreateDummy()

_DrawLimits($iMax_HScroll, $iMax_HScroll)

Local $cEnd = GUICtrlCreateDummy()
For $i = $cStart To $cEnd
    GUICtrlSetResizing($i, $GUI_DOCKALL)
Next

$cZoom_Minus = GUICtrlCreateButton("Zoom -", 10, 10, 80, 30)
$cZoom_Plus = GUICtrlCreateButton("Zoom +", 110, 10, 80, 30)

GUISetState(@SW_SHOW)

_GUIScrollBars_Init($hGUI)

_Set_Scroll_Params($hGUI)

GUIRegisterMsg($WM_HSCROLL, "_WM_HSCROLL")
GUIRegisterMsg($WM_VSCROLL, "_WM_VSCROLL")
GUIRegisterMsg($WM_MOUSEWHEEL, "_WM_MOUSEWHEEL")
GUIRegisterMsg($WM_MOUSEHWHEEL, "_WM_MOUSEHWHEEL")
GUIRegisterMsg($WM_ENTERSIZEMOVE, "_WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "_WM_EXITSIZEMOVE")
GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO")

While 1
    Switch GUIGetMsg()
        Case $cZoom_Plus
            $iMag *= 2
            $iMax_HScroll *= 2
            $iMax_VScroll *= 2
            _DrawLimits($iMax_HScroll, $iMax_HScroll)
            _Set_Scroll_Params($hGUI)
            WinSetTitle($hGUI, "", "Resizeable Test - Mag: " & $iMag)

        Case $cZoom_Minus
            If $iMag > 1 Then
                $iMag /= 2
                $iMax_HScroll /= 2
                $iMax_VScroll /= 2
                _DrawLimits($iMax_HScroll, $iMax_HScroll)
                _Set_Scroll_Params($hGUI)
                WinSetTitle($hGUI, "", "Resizeable Test - Mag: " & $iMag)
            EndIf

        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Set_Scroll_Params($hWnd)
    Local $aClientSize = WinGetClientSize($hWnd)

    ; Check if scrollbars needed
    Local $iH_Aperture = 0, $iV_Aperture = 0, $iH_Reduction = 0, $iV_Reduction = 0
    ; Loop to check if client area reduced by scrollbars
    For $i = 1 To 2
        If $aClientSize[0] < $iMax_HScroll + $iH_Reduction Then
            $iH_Aperture = $iMax_HScroll + $iH_Reduction
            $iV_Reduction = $iHSize     ; Height of HScrollbar
        EndIf
        If $aClientSize[1] < $iMax_VScroll + $iV_Reduction Then
            $iV_Aperture = $iMax_VScroll + $iV_Reduction
            $iH_Reduction = $iVSize     ; Width of VScrollbar
        EndIf
    Next

    $aRet = _GUIScrollbars_Size($iMax_HScroll, $iMax_VScroll, $aClientSize[0], $aClientSize[1])
    If Not @error Then
        If $iMax_HScroll >= $aClientSize[0] Then
            ; Show scrollbar
            _GUIScrollBars_ShowScrollBar($hGUI, $SB_HORZ, True)
            ; Set new parameters
            _GUIScrollBars_SetScrollInfoPage($hGUI, $SB_HORZ, $aRet[0])
            _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_HORZ, $aRet[1])
            ; Reset scrollbar positions
            If $iH_Aperture Then _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_HORZ, $iH_Pos)
        EndIf
        If $iMax_VScroll >= $aClientSize[1] Then
            _GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT, True)
            _GUIScrollBars_SetScrollInfoPage($hGUI, $SB_VERT, $aRet[2])
            _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_VERT, $aRet[3])
            If $iV_Aperture Then _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_VERT, $iV_Pos)
        EndIf
    EndIf

EndFunc   ;==>_Set_Scroll_Params

Func _DrawLimits($iMaxH, $iMaxV)

    For $i = 0 To 4
        GUICtrlDelete($aLabels[$i])
    Next

    $aLabels[0] = GUICtrlCreateLabel("", 0, 0, $iMaxH, $iMaxV)
    GUICtrlSetBkColor(-1, 0xFFCCCC)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $aLabels[1] = GUICtrlCreateLabel("", 0, 0, 10, 10)
    GUICtrlSetBkColor(-1, 0xFF0000)
    $aLabels[2] = GUICtrlCreateLabel("", 0, $iMaxV - 10, 10, 10)
    GUICtrlSetBkColor(-1, 0xFF0000)
    $aLabels[3] = GUICtrlCreateLabel("", $iMaxH - 10, 0, 10, 10)
    GUICtrlSetBkColor(-1, 0xFF0000)
    $aLabels[4] = GUICtrlCreateLabel("", $iMaxH - 10, $iMaxV - 10, 10, 10)
    GUICtrlSetBkColor(-1, 0xFF0000)

EndFunc   ;==>_DrawLimits

Func _WM_HSCROLL($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $lParam
    Local $iScrollCode = BitAND($wParam, 0x0000FFFF)

    Local $iIndex = -1, $iCharX, $iPosX
    Local $iMin, $iMax, $iPage, $iPos, $iTrackPos

    For $x = 0 To UBound($__g_aSB_WindowInfo) - 1
        If $__g_aSB_WindowInfo[$x][0] = $hWnd Then
            $iIndex = $x
            $iCharX = $__g_aSB_WindowInfo[$iIndex][2]
            ExitLoop
        EndIf
    Next
    If $iIndex = -1 Then Return 0

    ; ; Get all the horizontal scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $iMin = DllStructGetData($tSCROLLINFO, "nMin")
    $iMax = DllStructGetData($tSCROLLINFO, "nMax")
    $iPage = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $iPosX = DllStructGetData($tSCROLLINFO, "nPos")
    $iPos = $iPosX
    $iTrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $iMin, $iMax
    Switch $iScrollCode

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

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

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

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

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

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $iPos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($iPos <> $iPosX) Then _GUIScrollBars_ScrollWindow($hWnd, $iCharX * ($iPosX - $iPos), 0)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_HSCROLL

Func _WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)

    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $iIndex = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

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

    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP
            DllStructSetData($tSCROLLINFO, "nPos", $Min)
        Case $SB_BOTTOM
            DllStructSetData($tSCROLLINFO, "nPos", $Max)
        Case $SB_LINEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
        Case $SB_LINEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
        Case $SB_PAGEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
        Case $SB_PAGEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
        Case $SB_THUMBTRACK
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_VSCROLL

Func _WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $lParam
    Local $iDirn, $iDelta = BitShift($wParam, 16) ; Mouse wheel movement
    If $hWnd = $hGUI Then
        If BitAND($wParam, 0x0000FFFF) Then ; If Ctrl or Shft pressed move Horz scrollbar
            $iDirn = $SB_LINERIGHT
            If $iDelta > 0 Then $iDirn = $SB_LINELEFT
            For $i = 1 To 7
                _SendMessage($hWnd, $WM_HSCROLL, $iDirn)
            Next
        Else ; Move Vert scrollbar
            $iDirn = $SB_LINEDOWN
            If $iDelta > 0 Then $iDirn = $SB_LINEUP
            For $i = 1 To 7
                _SendMessage($hWnd, $WM_VSCROLL, $iDirn)
            Next
        EndIf
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_MOUSEWHEEL

Func _WM_MOUSEHWHEEL($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $lParam
    Local $iDirn = $SB_LINERIGHT
    If BitShift($wParam, 16) > 0 Then $iDirn = $SB_LINELEFT ; Mouse wheel movement
    If $hWnd = $hGUI Then
        For $i = 1 To 7
            _SendMessage($hWnd, $WM_HSCROLL, $iDirn)
        Next
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_MOUSEHWHEEL

Func _WM_ENTERSIZEMOVE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $wParam, $lParam

    If $hWnd = $hGUI Then
        ; Store current scrollbar positions
        $iH_Pos = _GUIScrollBars_GetScrollInfoPos($hWnd, $SB_HORZ)
        $iV_Pos = _GUIScrollBars_GetScrollInfoPos($hWnd, $SB_VERT)
        ; Reset scrollbar positions to 0
        _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_HORZ, 0)
        _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_VERT, 0)
        ; Hide scrollbars
        _GUIScrollBars_ShowScrollBar($hWnd, $SB_BOTH, False)
    EndIf

EndFunc   ;==>_WM_ENTERSIZEMOVE

Func _WM_EXITSIZEMOVE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $wParam, $lParam

    ; Check if handle matches
    If $hWnd = $hGUI Then
        _Set_Scroll_Params($hWnd)
    EndIf

EndFunc   ;==>_WM_EXITSIZEMOVE

Func _WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
    Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $iGUI_MinX)     ; min X
    DllStructSetData($tagMaxinfo, 8, $iGUI_MinY)     ; min Y
    DllStructSetData($tagMaxinfo, 9, $iGUI_MaxX)     ; max X
    DllStructSetData($tagMaxinfo, 10, $iGUI_MaxY)     ; max Y
    Return 0
EndFunc   ;==>_WM_GETMINMAXINFO

Close enough to be worth pursuing further?

M23

Edited by Melba23
Added MouseWheel handlers

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

tatane,

No,  I used the same version as in the current release - what do you see that makes you think "buggy"?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi,

No problem when I start the script.

As soon as I resize the GUI, a second GUI appears/disappears on my second screen. When the Gui is at max size, the scrollbars are still there and I can scroll down/right.

Sorry to bother you with that, if Windows scrollbars stuff is so messy, I will remove the resize Gui functionality and replace it by 3 differents resolutions.

Link to comment
Share on other sites

  • Moderators

tatane,

Sorry for the delay in replying - busy week in the real world!

No idea about the second GUI - nothing in the script should produce that. But here is a better developed script for you to play with - see what you can break this time:

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

Global $iMag = 1
Global $iMax_HScroll = 600, $iMax_VScroll = 600


Global $iVSize = _WinAPI_GetSystemMetrics(2) ; Width of VScrollbar:  SM_CXVSCROLL
Global $iHSize = _WinAPI_GetSystemMetrics(3) ; Height of HScrollbar: SM_CYHSCROLL
Global $iH_Pos, $iV_Pos, $bH_Vis = False, $bV_Vis = False

; Set max/min sizes
Global $iGUI_MinX = 200, $iGUI_MinY = 200
Global $iGUI_MaxX = $iMax_HScroll + $iVSize, $iGUI_MaxY = $iMax_VScroll + $iHSize + 21 ; Why 21? No idea

Global $aLabels[5]

$hGUI = GUICreate("Resizeable Test - Mag: 1", 400, 400, Default, Default, $WS_SIZEBOX)
GUISetBkColor(0xCCFFCC)

Local $cStart = GUICtrlCreateDummy()

_DrawLimits($iMax_HScroll, $iMax_HScroll)

Local $cEnd = GUICtrlCreateDummy()
For $i = $cStart To $cEnd
    GUICtrlSetResizing($i, $GUI_DOCKALL)
Next

$cZoom_Minus = GUICtrlCreateButton("Zoom -", 10, 10, 80, 30)
$cZoom_Plus = GUICtrlCreateButton("Zoom +", 110, 10, 80, 30)

GUISetState(@SW_SHOW)

_GUIScrollBars_Init($hGUI)

_Set_Scroll_Params($hGUI)

GUIRegisterMsg($WM_HSCROLL, "_WM_HSCROLL")
GUIRegisterMsg($WM_VSCROLL, "_WM_VSCROLL")
GUIRegisterMsg($WM_MOUSEWHEEL, "_WM_MOUSEWHEEL")
GUIRegisterMsg($WM_MOUSEHWHEEL, "_WM_MOUSEHWHEEL")
GUIRegisterMsg($WM_ENTERSIZEMOVE, "_WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "_WM_EXITSIZEMOVE")
GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO")

While 1
    Switch GUIGetMsg()
        Case $cZoom_Plus
            $iMag *= 2
            $iMax_HScroll *= 2
            $iMax_VScroll *= 2
            _DrawLimits($iMax_HScroll, $iMax_HScroll)
            _Set_Scroll_Params($hGUI)
            WinSetTitle($hGUI, "", "Resizeable Test - Mag: " & $iMag)

        Case $cZoom_Minus
            If $iMag > 1 Then
                $iMag /= 2
                $iMax_HScroll /= 2
                $iMax_VScroll /= 2
                _DrawLimits($iMax_HScroll, $iMax_HScroll)
                _Set_Scroll_Params($hGUI)
                WinSetTitle($hGUI, "", "Resizeable Test - Mag: " & $iMag)
            EndIf

        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Set_Scroll_Params($hWnd)
    Local $aClientSize = WinGetClientSize($hWnd)

    ; Check if scrollbars needed
    Local $iH_Aperture = 0, $iV_Aperture = 0, $iH_Reduction = 0, $iV_Reduction = 0
    ; Loop to check if client area reduced by scrollbars
    For $i = 1 To 2
        If $aClientSize[0] < $iMax_HScroll + $iH_Reduction Then
            $iH_Aperture = $iMax_HScroll + $iH_Reduction
            $iV_Reduction = $iHSize     ; Height of HScrollbar
        EndIf
        If $aClientSize[1] < $iMax_VScroll + $iV_Reduction Then
            $iV_Aperture = $iMax_VScroll + $iV_Reduction
            $iH_Reduction = $iVSize     ; Width of VScrollbar
        EndIf
    Next

    $aRet = _GUIScrollbars_Size($iMax_HScroll, $iMax_VScroll, $aClientSize[0], $aClientSize[1])
    If Not @error Then
        If $iMax_HScroll >= $aClientSize[0] Then
            ; Show scrollbar
            _GUIScrollBars_ShowScrollBar($hGUI, $SB_HORZ, True)
            $bH_Vis = True
            ; Set new parameters
            _GUIScrollBars_SetScrollInfoPage($hGUI, $SB_HORZ, $aRet[0])
            _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_HORZ, $aRet[1])
            ; Reset scrollbar positions
            If $iH_Aperture Then _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_HORZ, $iH_Pos)
        EndIf
        If $iMax_VScroll >= $aClientSize[1] Then
            _GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT, True)
            $bV_Vis = True
            _GUIScrollBars_SetScrollInfoPage($hGUI, $SB_VERT, $aRet[2])
            _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_VERT, $aRet[3])
            If $iV_Aperture Then _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_VERT, $iV_Pos)
        EndIf
    EndIf

EndFunc   ;==>_Set_Scroll_Params

Func _DrawLimits($iMaxH, $iMaxV)

    For $i = 0 To 4
        GUICtrlDelete($aLabels[$i])
    Next

    $aLabels[0] = GUICtrlCreateLabel("", 0, 0, $iMaxH, $iMaxV)
    GUICtrlSetBkColor(-1, 0xFFCCCC)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $aLabels[1] = GUICtrlCreateLabel("", 0, 0, 10, 10)
    GUICtrlSetBkColor(-1, 0xFF0000)
    $aLabels[2] = GUICtrlCreateLabel("", 0, $iMaxV - 10, 10, 10)
    GUICtrlSetBkColor(-1, 0xFF0000)
    $aLabels[3] = GUICtrlCreateLabel("", $iMaxH - 10, 0, 10, 10)
    GUICtrlSetBkColor(-1, 0xFF0000)
    $aLabels[4] = GUICtrlCreateLabel("", $iMaxH - 10, $iMaxV - 10, 10, 10)
    GUICtrlSetBkColor(-1, 0xFF0000)

EndFunc   ;==>_DrawLimits

Func _WM_HSCROLL($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $lParam
    Local $iScrollCode = BitAND($wParam, 0x0000FFFF)

    Local $iIndex = -1, $iCharX, $iPosX
    Local $iMin, $iMax, $iPage, $iPos, $iTrackPos

    For $x = 0 To UBound($__g_aSB_WindowInfo) - 1
        If $__g_aSB_WindowInfo[$x][0] = $hWnd Then
            $iIndex = $x
            $iCharX = $__g_aSB_WindowInfo[$iIndex][2]
            ExitLoop
        EndIf
    Next
    If $iIndex = -1 Then Return 0

    ; ; Get all the horizontal scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $iMin = DllStructGetData($tSCROLLINFO, "nMin")
    $iMax = DllStructGetData($tSCROLLINFO, "nMax")
    $iPage = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $iPosX = DllStructGetData($tSCROLLINFO, "nPos")
    $iPos = $iPosX
    $iTrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $iMin, $iMax
    Switch $iScrollCode

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

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

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

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

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

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

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $iPos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($iPos <> $iPosX) Then _GUIScrollBars_ScrollWindow($hWnd, $iCharX * ($iPosX - $iPos), 0)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_HSCROLL

Func _WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)

    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $iIndex = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

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

    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP
            DllStructSetData($tSCROLLINFO, "nPos", $Min)
        Case $SB_BOTTOM
            DllStructSetData($tSCROLLINFO, "nPos", $Max)
        Case $SB_LINEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)
        Case $SB_LINEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)
        Case $SB_PAGEUP
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)
        Case $SB_PAGEDOWN
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)
        Case $SB_THUMBTRACK
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_VSCROLL

Func _WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $lParam

    Local $iDirn, $iDelta = BitShift($wParam, 16) ; Mouse wheel movement
    If $hWnd = $hGUI Then

        If BitAND($wParam, 0x0000FFFF) Then ; If Ctrl or Shft pressed move Horz scrollbar
            ; Check if max size
            If $bH_Vis Then
                $iDirn = $SB_LINERIGHT
                If $iDelta > 0 Then $iDirn = $SB_LINELEFT
                For $i = 1 To 7
                    _SendMessage($hWnd, $WM_HSCROLL, $iDirn)
                Next
            EndIf

        Else     ; Move Vert scrollbar

            If $bV_Vis Then
                $iDirn = $SB_LINEDOWN
                If $iDelta > 0 Then $iDirn = $SB_LINEUP
                For $i = 1 To 7
                    _SendMessage($hWnd, $WM_VSCROLL, $iDirn)
                Next
            EndIf
        EndIf
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_MOUSEWHEEL

Func _WM_MOUSEHWHEEL($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $lParam
    Local $iDirn = $SB_LINERIGHT
    If BitShift($wParam, 16) > 0 Then $iDirn = $SB_LINELEFT ; Mouse wheel movement
    If $hWnd = $hGUI Then
        ; Check if max size
        If $bH_Vis Then
            For $i = 1 To 7
                _SendMessage($hWnd, $WM_HSCROLL, $iDirn)
            Next
        EndIf
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_MOUSEHWHEEL

Func _WM_ENTERSIZEMOVE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $wParam, $lParam

    If $hWnd = $hGUI Then
        ; Store current scrollbar positions
        $iH_Pos = _GUIScrollBars_GetScrollInfoPos($hWnd, $SB_HORZ)
        $iV_Pos = _GUIScrollBars_GetScrollInfoPos($hWnd, $SB_VERT)
        ; Reset scrollbar positions to 0
        _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_HORZ, 0)
        _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_VERT, 0)
        ; Hide scrollbars
        _GUIScrollBars_ShowScrollBar($hWnd, $SB_BOTH, False)
        $bV_Vis = False
        $bH_Vis = False
    EndIf

EndFunc   ;==>_WM_ENTERSIZEMOVE

Func _WM_EXITSIZEMOVE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $wParam, $lParam

    ; Check if handle matches
    If $hWnd = $hGUI Then
        _Set_Scroll_Params($hWnd)
    EndIf

EndFunc   ;==>_WM_EXITSIZEMOVE

Func _WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
    Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $iGUI_MinX)     ; min X
    DllStructSetData($tagMaxinfo, 8, $iGUI_MinY)     ; min Y
    DllStructSetData($tagMaxinfo, 9, $iGUI_MaxX)     ; max X
    DllStructSetData($tagMaxinfo, 10, $iGUI_MaxY)     ; max Y
    Return 0
EndFunc   ;==>_WM_GETMINMAXINFO

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Sorry, there are some problem with this version too.

I will try something else. If even you have some problem with scrollbars, I'm not skilled enough to do better.

I thank you for the time you passed helping me.

Link to comment
Share on other sites

  • Moderators

tatane,

No problem. Sorry we could not come up with something which worked for you, but as I have said many times: scrollbars are tricky things at the best of times and using resizable GUIs just makes it worse!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 1 year later...

Thanks for your great contributions to autoit community.

I'm currently using your scroll UDF and I came to a problem.

My problem is that the scroll almost always causes the gui to freeze. If you can help me solve his problem, it would be great.

Thanks in advance for you time.

Link to comment
Share on other sites

  • Moderators

Siwa,

The problem is very obviously in line #3245.

...

But if you post your code I might well be able to offer some sensible help.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Siwa,

I can see the problem. It looks to me as if you have too many controls in the GUI and Windows/AutoIt cannot keep up with scrolling that many - particularly as so many of them are graphic controls (28 per element) which are notoriously resource heavy. My suspicions seem to be confirmed by the fact that if I reduce the size of the $Names array to around 10 then the GUI scrolls without problem - as is the case if I remove all the graphic controls.

I suggest you try to simplify the the GUI - for example as each element is identical, do you need ALL the controls for each one? Can you not have a simple scrollable list of the elements pulled from the Excel sheet and then a separate section to hold a single instance of the all the complicated controls which will only affect the selected element?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Unfortunately I do need every element in my gui, especially the graphic controls. ( and It's not finished yet and will be much more heaver. )

Your idea is a good one,  I will take it in mind.

But I wonder if I can call every item separately( something like Adlib(but just once), or any other function which runs simultaneously). I mean the gui loads itself, and I call the elements after the gui loads, I guess his way we can reduce the freezing time ?

Edited by Siwa
Link to comment
Share on other sites

  • Melba23 changed the title to Scrollbars Made Easy - New version 27 Jan 22

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...