Jump to content

_GUIScrollBars_ and Scrollsteps


Recommended Posts

Hello, it seems like the smallest value you can scroll is 1 , but if you scroll really slowly it looks jittery (you can see clearly each step). Is there a way to achive smoother scrolling? i am trying to make the GUI scrollable with the mouse (holding right mouse button down and moving the mouse to scroll) 

thanks in advance 🖐️

Link to comment
Share on other sites

13 hours ago, Aaron3569 said:

Is there a way to achive smoother scrolling?

Based on your script in another post, here is a smooth scroll of 1 pixel (adjustable in variable $iPixels) in 4 directions, using 4 direction keys. No scrollbars. It may help you to achieve your goal :

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

HotKeySet("{RIGHT}", "ScrollRight")
HotKeySet("{LEFT}", "ScrollLeft")
HotKeySet("{UP}", "ScrollUp")
HotKeySet("{DOWN}", "ScrollDown")

Global $iPixels = 1

$hParent = GUICreate("Parent", 1000, 700)
GUICtrlCreateButton("Button", 50, 50, 50, 50)
GUISetState()

$hChild = GUICreate("Child", 200, 200, -1,-1, $WS_CHILD , -1, $hParent)
GUISetBkColor(0x000000)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Func ScrollRight()
    _ScrollWindow($hParent, $iPixels, 0)
EndFunc

Func ScrollLeft()
    _ScrollWindow($hParent, - $iPixels, 0)
EndFunc

Func ScrollUp()
    _ScrollWindow($hParent, 0, - $iPixels)
EndFunc

Func ScrollDown()
    _ScrollWindow($hParent, 0, $iPixels)
EndFunc

Func _ScrollWindow($hWnd, $iXAmount, $iYAmount)
    Return DllCall("user32.dll", "bool", "ScrollWindow", "hwnd", $hWnd, "int", $iXAmount, "int", $iYAmount, "ptr", 0, "ptr", 0)[0]
EndFunc   ;==>_ScrollWindow
Edited by pixelsearch
Link to comment
Share on other sites

8 hours ago, pixelsearch said:

Based on your script in another post, here is a smooth scroll of 1 pixel (adjustable in variable $iPixels) in 4 directions, using 4 direction keys. No scrollbars. It may help you to achieve your goal :

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

HotKeySet("{RIGHT}", "ScrollRight")
HotKeySet("{LEFT}", "ScrollLeft")
HotKeySet("{UP}", "ScrollUp")
HotKeySet("{DOWN}", "ScrollDown")

Global $iPixels = 1

$hParent = GUICreate("Parent", 1000, 700)
GUICtrlCreateButton("Button", 50, 50, 50, 50)
GUISetState()

$hChild = GUICreate("Child", 200, 200, -1,-1, $WS_CHILD , -1, $hParent)
GUISetBkColor(0x000000)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Func ScrollRight()
    _ScrollWindow($hParent, $iPixels, 0)
EndFunc

Func ScrollLeft()
    _ScrollWindow($hParent, - $iPixels, 0)
EndFunc

Func ScrollUp()
    _ScrollWindow($hParent, 0, - $iPixels)
EndFunc

Func ScrollDown()
    _ScrollWindow($hParent, 0, $iPixels)
EndFunc

Func _ScrollWindow($hWnd, $iXAmount, $iYAmount)
    Return DllCall("user32.dll", "bool", "ScrollWindow", "hwnd", $hWnd, "int", $iXAmount, "int", $iYAmount, "ptr", 0, "ptr", 0)[0]
EndFunc   ;==>_ScrollWindow

thats awesome, thanks aigan !

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