atvaxn Posted May 9 Posted May 9 I have a gui, which is scrollable (like a website) There for I use GUIScrollbars_Ex.au3. It works perfect, but on my Laptop with touch screen, I can't scroll using my fingers (with touch / swiping gesture) Is there any solution for that?
SOLVE-SMART Posted May 10 Posted May 10 Hi @atvaxn 👋 , please share a reproducible code, also the dependency "GUIScrollbars_Ex.au3" (as attachment). Then you will probably get suggestions 😀 . Best regards Sven ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet Reveal hidden contents 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
atvaxn Posted May 10 Author Posted May 10 yeah, I take a very simple example, using GUIScrollbars_Ex.au3 In the ZIP is an example: GUIScrollbars_Ex_Example_2.au3 How to scroll (swipe) up and down, using a laptop with touch screen? #include <GUIConstantsEx.au3> #include "GUIScrollbars_Ex.au3" ; Create GUI with red background $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xFF0000, $hGUI) ; To get cursor keys to scroll GUI, create controls AFTER GUISetState GUISetState() ; Create labels to show scrolling GUICtrlCreateLabel("", 0, 0, 500, 500) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 500, 500, 500, 500) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 0, 500, 500, 500) GUICtrlSetBkColor(-1, 0x0000FF) GUICtrlCreateLabel("", 500, 0, 500, 500) GUICtrlSetBkColor(-1, 0x0000FF) GUICtrlCreateLabel("", 990, 990, 10, 10) GUICtrlSetBkColor(-1, 0) ; Generate scrollbars - Yes, this is all you need to do!!!!!!! _GUIScrollbars_Generate($hGUI, 1000, 1000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIScrollbars_EventMonitor() WEnd
MattyD Posted May 10 Posted May 10 (edited) Hi atvaxn, In a nutshell, you'll likely need to handle the $WM_GESTURE message. If you can work out how the UDF uses WM_SCROLL to get the form to move, i'd imagine you should be able to retrofit the UDF with this. Try scrolling with your fingers.... #include <WindowsConstants.au3> #include <GUIConstants.au3> GUIRegisterMsg($WM_GESTURE, "WM_GESTURE") Global $hGUI = GUICreate("Test", 500, 500) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_GESTURE($hWnd, $uMsg, $wParam, $lParam) ConsoleWrite("Gesture" & @CRLF) EndFunc Edited May 10 by MattyD
MattyD Posted May 11 Posted May 11 Just to put a bit more meat on the bones - I'm sure there's plenty of stuff that can be improved... expandcollapse popup#include <GUIConstantsEx.au3> #include "GUIScrollbars_Ex.au3" ;;;;;;;;; Gesture Stuff ;;;;;;;;;;;;;;; Global Const $tagGESTUREINFO = "struct;uint size;dword flags;dword id;hwnd target;short x;short y;dword instanceId;dword sequenceId;uint64 arguments;uint extraArgs;endstruct" Global Const $GF_BEGIN = 0x00000001 Global Const $GF_INERTIA = 0x00000002 Global Const $GF_END = 0x00000004 Global Const $GID_BEGIN = 1 Global Const $GID_END = 2 Global Const $GID_ZOOM = 3 Global Const $GID_PAN = 4 Global Const $GID_ROTATE = 5 Global Const $GID_TWOFINGERTAP = 6 Global Const $GID_PRESSANDTAP = 7 GUIRegisterMsg($WM_GESTURE, "WM_GESTURE") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Create GUI with red background $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xFF0000, $hGUI) ; To get cursor keys to scroll GUI, create controls AFTER GUISetState GUISetState() ; Create labels to show scrolling GUICtrlCreateLabel("", 0, 0, 500, 500) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 500, 500, 500, 500) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 0, 500, 500, 500) GUICtrlSetBkColor(-1, 0x0000FF) GUICtrlCreateLabel("", 500, 0, 500, 500) GUICtrlSetBkColor(-1, 0x0000FF) GUICtrlCreateLabel("", 990, 990, 10, 10) GUICtrlSetBkColor(-1, 0) ; Generate scrollbars - Yes, this is all you need to do!!!!!!! _GUIScrollbars_Generate($hGUI, 1000, 1000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIScrollbars_EventMonitor() WEnd Func WM_GESTURE($hWnd, $uMsg, $wParam, $lParam) Local $iReturnVal = $GUI_RUNDEFMSG Local $tGESTUREINFO = DllStructCreate($tagGESTUREINFO) $tGESTUREINFO.size = DllStructGetSize($tGESTUREINFO) _WinAPI_GetGestureInfo($lParam, DllStructGetPtr($tGESTUREINFO)) Local Static $iX, $iY, $iDeltaX, $iDeltaY Local $iIndex = -1, $iDirn Switch $tGESTUREINFO.id Case $GID_PAN If BitAND($tGESTUREINFO.flags, $GF_BEGIN) = $GF_BEGIN Then $iX = $tGESTUREINFO.x $iY = $tGESTUREINFO.y EndIf $iDeltaX = $tGESTUREINFO.x - $iX $iDeltaY = $tGESTUREINFO.y - $iY $iX += $iDeltaX $iY += $iDeltaY ;ConsoleWrite(StringFormat("scrollDelta [%d, %d]", $iDeltaX, $iDeltaY) & @CRLF) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Basically copied from __Scrollbars_WM_MOUSEWHEEL.... Local $iIndex = -1 For $i = 0 To UBound($__g_aSB_WindowInfo) - 1 If $hWnd = $__g_aSB_WindowInfo[$i][0] Then $iIndex = $i Next If $iDeltaX Then $iDirn = $SB_LINERIGHT If $iDeltaX > 0 Then $iDirn = $SB_LINELEFT For $i = 1 To $__g_aSB_WindowInfoEx[$iIndex][6] _SendMessage($hWnd, $WM_HSCROLL, $iDirn) Next EndIf If $iDeltaY Then $iDirn = $SB_LINEDOWN If $iDeltaY > 0 Then $iDirn = $SB_LINEUP For $i = 1 To $__g_aSB_WindowInfoEx[$iIndex][6] _SendMessage($hWnd, $WM_VSCROLL, $iDirn) Next EndIf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; _WinAPI_CloseGestureInfoHandle($lParam) ;Close this for messages we're handling, the DefWindowProc will close anything we ignore. $iReturnVal = 0 ;If message is handled, return 0 - otherwise return $GUI_RUNDEFMSG (which will run autoit's window proc.) EndSwitch Return $iReturnVal EndFunc ;==>WM_GESTURE Func _WinAPI_GetGestureInfo($hGestureInfo, $pGestureInfo, $hDllHandle = 0) Local $vDll = ($hDllHandle) ? $hDllHandle : "User32.dll" Local $aCall = DllCall($vDll, "bool", "GetGestureInfo", "handle", $hGestureInfo, "ptr", $pGestureInfo) If @error Then Return SetError(@error, @extended, 0) Return SetError($aCall[0] = 0, 0, $aCall[2]) EndFunc ;==>_WinAPI_GetGestureInfo Func _WinAPI_CloseGestureInfoHandle($hGestureInfo, $hDllHandle = 0) Local $vDll = ($hDllHandle) ? $hDllHandle : "User32.dll" Local $aCall = DllCall($vDll, "bool", "CloseGestureInfoHandle", "handle", $hGestureInfo) If @error Then Return SetError(@error, @extended, False) Return SetError($aCall[0] = 0, 0, $aCall[0] = 1) EndFunc ;==>_WinAPI_CloseGestureInfoHandle
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now