Jump to content

[solved] GUIScrollbars_Ex scroll bar and heavy flashing


NDog
 Share

Recommended Posts

I have a GUI which the idea is to scan a folder for executable files and output a script to silently install those software, in the order you want.

I would like to ask a few questions

1) Most important is I am using GUIScrollbars_Ex.au3 to have a vertical scroll bar, incase the items exceeds my GUI, I want to be able to scroll up and down, however if I delete an item past the end of the page, eg the last item, it makes the scroll bar appear at where the item was rebuilt.

2) My rudimentary GUI is flashing a lot, as I have to rebuild the buttons a lot, could someone advise or point on how to stop such heavy flashing and have a smoother experience ?

3) speed is slow.

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <ComboConstants.au3>

#include <File.au3>
#include <StringConstants.au3>

#include <MsgBoxConstants.au3>
#include <GUIScrollbars_Ex.au3> ; GUIScrollBars_Ex by Melba23

Global $aRow[0][0]


; Main GUI header
$hGUI = GUICreate("Silent Batch Maker", 850, 550, -1, -1)
$idBrowse = GUICtrlCreateButton("Browse", 9, 15, 100, 30)
$idSave = GUICtrlCreateButton("Save", 622, 15, 100, 30)
$idLoad = GUICtrlCreateButton("Load", 728, 15, 100, 30)
$lbFolder = GUICtrlCreateLabel("Browse for a folder", 120, 15, 487, 28, $SS_CENTERIMAGE)


;$idDelete = GUICtrlCreateButton("Delete",789,60,39,21)

GUICtrlCreateRadio("Lock", 694, 60, 42, 21)
GUICtrlCreateRadio("Unlock", 736, 60, 53, 21)

GUISetState(@SW_SHOW)

While True
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $idBrowse
            Local $sDir = Load()
            If Not $sDir = False Then
                GUICtrlSetData($lbFolder, $sDir)
                $aFiles = _FileListToArrayRec($sDir, '*.msi;*.mst;*.exe', $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_RELPATH)
                If Not @error Then
                    DeleteAllGUIobjects()
                    CreateRows($aFiles)
                EndIf
            EndIf
        Case $nMsg = $idSave
            If IsDeclared("aFiles") Then
                Save($sDir)
            Else
                MsgBox(0, "Error", "Nothing to save!")
            EndIf
        Case Else
            For $i = 1 To UBound($aRow) - 1
                If ($nMsg = $aRow[$i][1]) Then ; Look for Up button pushed
                    ConsoleWrite("Up Button in Row " & $i & " was pressed!" & @CRLF)
                    If $i <> 1 Then
                        _ArraySwap2($aFiles[$i], $aFiles[$i - 1])
                        DeleteAllGUIobjects()
                        CreateRows($aFiles)
                    EndIf
                    ExitLoop ; Exit because we found the button, no need to keep searching
                ElseIf ($nMsg = $aRow[$i][2]) Then ; Look for Down button pushed
                    ConsoleWrite("Down Button in Row " & $i & " was pressed!" & @CRLF)
                    If $i <> $aFiles[0] Then
                        _ArraySwap2($aFiles[$i], $aFiles[$i + 1])
                        DeleteAllGUIobjects()
                        CreateRows($aFiles)
                    EndIf
                    ExitLoop ; Exit because we found the button, no need to keep searching
                ElseIf ($nMsg = $aRow[$i][6]) Then ; Look for Test button pushed
                    ConsoleWrite("Test Button in Row " & $i & " was pressed!" & @CRLF)
                    $path = GUICtrlRead($aRow[$i][3])
                    $switch = GUICtrlRead($aRow[$i][5])
                    ConsoleWrite("Test(" & $sDir & ", " & $path & ", " & $switch & ")" & @CRLF)
                    Test($sDir, $path, $switch)
                    ExitLoop ; Exit because we found the button, no need to keep searching
                ElseIf ($nMsg = $aRow[$i][7]) Then ; Look for Delete button pushed
                    ConsoleWrite("Delete Button in Row " & $i & " was pressed!" & @CRLF)
                    ; blank line and remove from array, shifting values up
                    $aFiles[$i] = ""
                    _ArrayRemoveBlanks($aFiles)
                    $aFiles[0] = $aFiles[0] - 1 ; decrease count in [0]
                    ; rebuild the GUI from array
                    DeleteAllGUIobjects()
                    ;_ArrayDisplay($aFiles, "After")
                    CreateRows($aFiles)
                    ExitLoop ; Exit because we found the button, no need to keep searching
                EndIf
            Next
    EndSelect
WEnd


Func Load()
    ; Display an open dialog to select a file.
    Local Const $sMessage = "Select a folder"
    Local $sFileSelectFolder = FileSelectFolder($sMessage, "C:\Windows\System32\DriverStore\FileRepository")
    If @error Then
        Return False
    Else
        Return $sFileSelectFolder
    EndIf
EndFunc   ;==>Load


Func Save($saveDir)
    ; take all the exe files and switches and generate a batch file in the same order
    Local $msg
    $msg = '@echo off&cls' & @CRLF
    $msg &= 'mode 80' & @CRLF
    $msg &= 'title Install Software' & @CRLF
    $msg &= '' & @CRLF
    For $i = 1 To UBound($aRow) - 1
        $path = GUICtrlRead($aRow[$i][3])
        $switch = GUICtrlRead($aRow[$i][5])
        $msg &= '"%~dp0' & $path & '" ' & $switch & @CRLF
    Next

    MsgBox(0, 'Debug', $msg)

    Local $File = FileOpen($saveDir & '\install-software.cmd', 2) ;Use UTF8, overwrite existing data, create directory
    FileWrite($File, $msg)
    FileClose($File)
EndFunc   ;==>Save


Func Test($rootdir, $path, $switch)
    ; Run test command with argument
    If FileExists($rootdir & "\" & $path) Then
        If GetFileExtension($aFiles[$i]) == ".exe" Then Run($rootdir & '\' & $path & ' ' & $switch)
        If GetFileExtension($aFiles[$i]) == ".msi" Then Run('msiexec /i "' & $rootdir & '\' & $path & '" ' & $switch)
        If GetFileExtension($aFiles[$i]) == ".mst" Then Run('msiexec /update "' & $rootdir & '\' & $path & '" ' & $switch)
    Else
        MsgBox(0, "Error locating file", "Cannot find file @ " & @CRLF & $rootdir & "\" & $path)
    EndIf
EndFunc   ;==>Test


Func GetFileExtension($File)
    ; return file extension, eg .exe, .msi, .mst
    For $YLoop = StringLen($File) To 1 Step -1
        If StringMid($File, $YLoop, 1) == "." Then
            $fl_Ext = StringMid($File, $YLoop)
            $YLoop = 1
        EndIf
    Next
    Return StringLower($fl_Ext)
EndFunc   ;==>GetFileExtension


Func DeleteAllGUIobjects()
    For $i = 1 To UBound($aRow) - 1
        For $j = 0 To UBound($aRow, 2) - 1
            GUICtrlDelete($aRow[$i][$j])
        Next
    Next
EndFunc   ;==>DeleteAllGUIobjects


Func CreateRows(ByRef $aFiles)
    ; Takes an array of files and creates rows as required
    ;$lbOrder               = 0
    ;$idButtonUp            = 1
    ;$idButtonDown          = 2
    ;$idComboPath           = 3
    ;$idIcon                = 4
    ;$idComboSwitch         = 5
    ;$idButtonTest          = 6
    ;$idButtonDelete        = 7
    ;$idInputRegKey         = 8
    ;$idInputDisplayName    = 9
    ;$idInputDisplayVersion = 10
    Dim $aRow[($aFiles[0] + 1)][10 + 1] ; variable used in the while loop
    For $i = 1 To $aFiles[0]
        $x = $i * 30 + 4 + $i * 26 ; first value = 60
        ; Left column
        $aRow[$i][0] = GUICtrlCreateLabel("[" & $i & "]", 8, $x + 10, 26, 21, BitOR($SS_CENTER, $SS_CENTERIMAGE))
            GUICtrlSetState(-1, BitOR($GUI_CHECKED, $GUI_SHOW, $GUI_ENABLE))
            GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
        $aRow[$i][1] = GUICtrlCreateButton("Up", 34, $x + 10, 39, 21)
        $aRow[$i][2] = GUICtrlCreateButton("Down", 74, $x + 10, 39, 21)
        ; Middle column
        $aRow[$i][3] = GUICtrlCreateCombo($aFiles[$i], 113, $x, 393, 21)
        $aRow[$i][4] = GUICtrlCreateIcon($sDir & "\" & $aFiles[$i], -1, 506, $x - 2, 24, 24)
            GUISetIcon(-1)
        $aRow[$i][5] = GUICtrlCreateCombo("", 527, $x, 107, 21)
            If GetFileExtension($aFiles[$i]) == ".exe" Then GUICtrlSetData(-1, "/s|/q|/silent|/S|/?", "/s")
            If GetFileExtension($aFiles[$i]) == ".msi" Then GUICtrlSetData(-1, "/qb|/passive|/?", "/passive")
            If GetFileExtension($aFiles[$i]) == ".mst" Then GUICtrlSetData(-1, "/qb|/passive|/?", "/passive")
        ; Right column
        $aRow[$i][6] = GUICtrlCreateButton("Test", 634, $x, 55, 21)
        $aRow[$i][7] = GUICtrlCreateButton("Delete", 789, $x, 39, 21)
        ; Lower column
        $aRow[$i][8] = GUICtrlCreateInput("", 113, $x + 26, 237, 21) ; Uninstall Registry Key
        $aRow[$i][9] = GUICtrlCreateInput("", 359, $x + 26, 213, 21) ; DisplayName
        $aRow[$i][10] = GUICtrlCreateInput("", 582, $x + 26, 107, 21) ; DisplayVersion
        ;_ArrayDisplay($aRow)
    Next
    _GUIScrollbars_Generate($hGUI, 0, $x + 60)
EndFunc   ;==>CreateRows


Func _ArrayRemoveBlanks(ByRef $arr)
    $idx = 0
    For $i = 0 To UBound($arr) - 1
        If $arr[$i] <> "" Then
            $arr[$idx] = $arr[$i]
            $idx += 1
        EndIf
    Next
    ReDim $arr[$idx]
EndFunc   ;==>_ArrayRemoveBlanks


Func _ArraySwap2(ByRef $1, ByRef $2)
    Local $Tmp = $1
    $1 = $2
    $2 = $Tmp
EndFunc   ;==>_ArraySwap2

 

GUIScrollbars_Ex.au3

Edited by NDog
Link to comment
Share on other sites

  • Moderators

NDog,

Let me take a look at how your script might be recast to prevent the problems you are seeing - it will keep me occupied on this grey and cold Sunday afternoon.

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

NDog,

Not too hard.

You need to use the other UDF in my Scrollbars UDF package - _GUIScrollBars_Size - as that is the one which deals with variable height scrollbars:

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <ComboConstants.au3>

#include <File.au3>
#include <StringConstants.au3>

#include <MsgBoxConstants.au3>
#include <GUIScrollbars_Size.au3> ; GUIScrollBars_Size by Melba23

Global $aRow[0][0]

; Main GUI header
$hGUI = GUICreate("Silent Batch Maker", 850, 550, -1, -1)
$idBrowse = GUICtrlCreateButton("Browse", 9, 15, 100, 30)
$idSave = GUICtrlCreateButton("Save", 622, 15, 100, 30)
$idLoad = GUICtrlCreateButton("Load", 728, 15, 100, 30)
$lbFolder = GUICtrlCreateLabel("Browse for a folder", 120, 15, 487, 28, $SS_CENTERIMAGE)

GUICtrlCreateRadio("Lock", 694, 60, 42, 21)
GUICtrlCreateRadio("Unlock", 736, 60, 53, 21)

GUISetState(@SW_SHOW)

; Register the handler
GUIRegisterMsg($WM_VSCROLL, "_Scrollbars_WM_VSCROLL")
; Initiate and hide the vertical scrollbar
_GUIScrollBars_Init($hGUI)
_GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT, False)
_GUIScrollBars_ShowScrollBar($hGUI, $SB_HORZ, False)

While True
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $idBrowse
            Local $sDir = Load()
            If Not $sDir = False Then
                GUICtrlSetData($lbFolder, $sDir)
                $aFiles = _FileListToArrayRec($sDir, '*.msi;*.mst;*.exe', $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_RELPATH)
                If Not @error Then
                    _CreateControls()
                EndIf
            EndIf
        Case $nMsg = $idSave
            If IsDeclared("aFiles") Then
                Save($sDir)
            Else
                MsgBox(0, "Error", "Nothing to save!")
            EndIf
        Case Else
            For $i = 1 To UBound($aRow) - 1
                If ($nMsg = $aRow[$i][1]) Then ; Look for Up button pushed
                    ConsoleWrite("Up Button in Row " & $i & " was pressed!" & @CRLF)
                    If $i <> 1 Then
                        _ArraySwap2($aFiles[$i], $aFiles[$i - 1])
                        _CreateControls()
                    EndIf
                    ExitLoop ; Exit because we found the button, no need to keep searching
                ElseIf ($nMsg = $aRow[$i][2]) Then ; Look for Down button pushed
                    ConsoleWrite("Down Button in Row " & $i & " was pressed!" & @CRLF)
                    If $i <> $aFiles[0] Then
                        _ArraySwap2($aFiles[$i], $aFiles[$i + 1])
                        _CreateControls()
                    EndIf
                    ExitLoop ; Exit because we found the button, no need to keep searching
                ElseIf ($nMsg = $aRow[$i][6]) Then ; Look for Test button pushed
                    ConsoleWrite("Test Button in Row " & $i & " was pressed!" & @CRLF)
                    $path = GUICtrlRead($aRow[$i][3])
                    $switch = GUICtrlRead($aRow[$i][5])
                    ConsoleWrite("Test(" & $sDir & ", " & $path & ", " & $switch & ")" & @CRLF)
                    Test($sDir, $path, $switch)
                    ExitLoop ; Exit because we found the button, no need to keep searching
                ElseIf ($nMsg = $aRow[$i][7]) Then ; Look for Delete button pushed
                    ConsoleWrite("Delete Button in Row " & $i & " was pressed!" & @CRLF)
                    ; blank line and remove from array, shifting values up
                    $aFiles[$i] = ""
                    _ArrayRemoveBlanks($aFiles)
                    $aFiles[0] = $aFiles[0] - 1 ; decrease count in [0]
                    ; rebuild the GUI from array
                    _CreateControls()

                    ExitLoop ; Exit because we found the button, no need to keep searching
                EndIf
            Next
    EndSelect
WEnd

Func _CreateControls()

    GUISetState(@SW_LOCK)
    DeleteAllGUIobjects()
    CreateRows($aFiles)
    GUISetState(@SW_UNLOCK)

EndFunc


Func Load()
    ; Display an open dialog to select a file.
    Local Const $sMessage = "Select a folder"
    Local $sFileSelectFolder = FileSelectFolder($sMessage, "C:\Windows\System32\DriverStore\FileRepository")
    If @error Then
        Return False
    Else
        Return $sFileSelectFolder
    EndIf
EndFunc   ;==>Load


Func Save($saveDir)
    ; take all the exe files and switches and generate a batch file in the same order
    Local $msg
    $msg = '@echo off&cls' & @CRLF
    $msg &= 'mode 80' & @CRLF
    $msg &= 'title Install Software' & @CRLF
    $msg &= '' & @CRLF
    For $i = 1 To UBound($aRow) - 1
        $path = GUICtrlRead($aRow[$i][3])
        $switch = GUICtrlRead($aRow[$i][5])
        $msg &= '"%~dp0' & $path & '" ' & $switch & @CRLF
    Next

    MsgBox(0, 'Debug', $msg)

    Local $File = FileOpen($saveDir & '\install-software.cmd', 2) ;Use UTF8, overwrite existing data, create directory
    FileWrite($File, $msg)
    FileClose($File)
EndFunc   ;==>Save


Func Test($rootdir, $path, $switch)
    ; Run test command with argument
    If FileExists($rootdir & "\" & $path) Then
        If GetFileExtension($aFiles[$i]) == ".exe" Then Run($rootdir & '\' & $path & ' ' & $switch)
        If GetFileExtension($aFiles[$i]) == ".msi" Then Run('msiexec /i "' & $rootdir & '\' & $path & '" ' & $switch)
        If GetFileExtension($aFiles[$i]) == ".mst" Then Run('msiexec /update "' & $rootdir & '\' & $path & '" ' & $switch)
    Else
        MsgBox(0, "Error locating file", "Cannot find file @ " & @CRLF & $rootdir & "\" & $path)
    EndIf
EndFunc   ;==>Test


Func GetFileExtension($File)
    ; return file extension, eg .exe, .msi, .mst
    For $YLoop = StringLen($File) To 1 Step -1
        If StringMid($File, $YLoop, 1) == "." Then
            $fl_Ext = StringMid($File, $YLoop)
            $YLoop = 1
        EndIf
    Next
    Return StringLower($fl_Ext)
EndFunc   ;==>GetFileExtension


Func DeleteAllGUIobjects()

    _GUIScrollBars_SetScrollInfoPos($hGUI, $SB_VERT, 0)

    For $i = 1 To UBound($aRow) - 1
        For $j = 0 To UBound($aRow, 2) - 1
            GUICtrlDelete($aRow[$i][$j])
        Next
    Next
EndFunc   ;==>DeleteAllGUIobjects


Func CreateRows(ByRef $aFiles)
    ; Takes an array of files and creates rows as required
    ;$lbOrder               = 0
    ;$idButtonUp            = 1
    ;$idButtonDown          = 2
    ;$idComboPath           = 3
    ;$idIcon                = 4
    ;$idComboSwitch         = 5
    ;$idButtonTest          = 6
    ;$idButtonDelete        = 7
    ;$idInputRegKey         = 8
    ;$idInputDisplayName    = 9
    ;$idInputDisplayVersion = 10

    Dim $aRow[($aFiles[0] + 1)][10 + 1] ; variable used in the while loop
    For $i = 1 To $aFiles[0]
        $x = $i * 30 + 4 + $i * 26 ; first value = 60
        ; Left column
        $aRow[$i][0] = GUICtrlCreateLabel("[" & $i & "]", 8, $x + 10, 26, 21, BitOR($SS_CENTER, $SS_CENTERIMAGE))
            GUICtrlSetState(-1, BitOR($GUI_CHECKED, $GUI_SHOW, $GUI_ENABLE))
            GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
        $aRow[$i][1] = GUICtrlCreateButton("Up", 34, $x + 10, 39, 21)
        $aRow[$i][2] = GUICtrlCreateButton("Down", 74, $x + 10, 39, 21)
        ; Middle column
        $aRow[$i][3] = GUICtrlCreateCombo($aFiles[$i], 113, $x, 393, 21)
        $aRow[$i][4] = GUICtrlCreateIcon($sDir & "\" & $aFiles[$i], -1, 506, $x - 2, 24, 24)
            GUISetIcon(-1)
        $aRow[$i][5] = GUICtrlCreateCombo("", 527, $x, 107, 21)
            If GetFileExtension($aFiles[$i]) == ".exe" Then GUICtrlSetData(-1, "/s|/q|/silent|/S|/?", "/s")
            If GetFileExtension($aFiles[$i]) == ".msi" Then GUICtrlSetData(-1, "/qb|/passive|/?", "/passive")
            If GetFileExtension($aFiles[$i]) == ".mst" Then GUICtrlSetData(-1, "/qb|/passive|/?", "/passive")
        ; Right column
        $aRow[$i][6] = GUICtrlCreateButton("Test", 634, $x, 55, 21)
        $aRow[$i][7] = GUICtrlCreateButton("Delete", 789, $x, 39, 21)
        ; Lower column
        $aRow[$i][8] = GUICtrlCreateInput("", 113, $x + 26, 237, 21) ; Uninstall Registry Key
        $aRow[$i][9] = GUICtrlCreateInput("", 359, $x + 26, 213, 21) ; DisplayName
        $aRow[$i][10] = GUICtrlCreateInput("", 582, $x + 26, 107, 21) ; DisplayVersion
        ;_ArrayDisplay($aRow)
    Next

    ; Hide scrollbar
    _GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT, False)
    If $x + 60 > 550 Then
        ; If a scrollbar is needed
        $aRet = _GUIScrollbars_Size(0, $x + 60, 850, 550)
        ; Reshow it with the correct parameters
        _GUIScrollBars_SetScrollInfoPage($hGUI, $SB_VERT, $aRet[2])
        _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_VERT, $aRet[3])
        _GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT, True)
    EndIf


EndFunc   ;==>CreateRows


Func _ArrayRemoveBlanks(ByRef $arr)
    $idx = 0
    For $i = 0 To UBound($arr) - 1
        If $arr[$i] <> "" Then
            $arr[$idx] = $arr[$i]
            $idx += 1
        EndIf
    Next
    ReDim $arr[$idx]
EndFunc   ;==>_ArrayRemoveBlanks


Func _ArraySwap2(ByRef $1, ByRef $2)
    Local $Tmp = $1
    $1 = $2
    $2 = $Tmp
EndFunc   ;==>_ArraySwap2

Func _Scrollbars_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   ;==>_Scrollbars_WM_VSCROLL

The flickering is removed by locking and unlocking the GUI during the rewriting process - I extracted that process into a separate funtion.

Good enough?

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

NDog,

Do not hesitate to ask if you have any questions.

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

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...