Moderators Melba23 Posted September 30, 2015 Moderators Posted September 30, 2015 (edited) Qwerty212,After a disastrous attempt to split the relevant posts from the UDF thread which nearly brought down the forum and resulted in the posts being lost forever, I am starting this new thread to renew the discussion outside the UDF thread itself.For new readers, Qwerty212 wants to get touchscreen gesture support in my Scrollbars UDF - the lost posts were basically discussing what his touchscreen did (scroll when the scrollbars were swiped) and did not do (scroll when the control/GUI was swiped) and some code snippets seeing what messages were being generated. Everything is complicated by the fact that I do not have as touchscreen on which to test!Here is a new version of the test code which produces some console output. Can you please swipe away and then let me have a description of what exactly you did, what happened to the GUI, and the relevant output from SciTE:expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include "GUIScrollbars_Ex.au3" Global Const $tagGESTUREINFO = "UINT cbSize; DWORD dwFlags; DWORD dwID; HWND hwndTarget; short X; short Y; DWORD dwInstanceID; DWORD dwSequenceID; UINT64 ullArgumengs; UINT cbExtraArgs" Global $tGesInfo = DllStructCreate($tagGESTUREINFO) DllStructSetData($tGesInfo, "cbSize", DllStructGetSize($tGesInfo)) Global $pGesInfo = DllStructGetPtr($tGesInfo) Global $aDirn[5] = ["", "UP", "DOWN", "LEFT", "RIGHT"] $hGUI = GUICreate("WM_GESTURE Test", 500, 500) $cLabel = GUICtrlCreateLabel("", 0, 0, 1000, 1000) GUICtrlSetState($cLabel, $GUI_DISABLE) $sData = "" For $i = 1 To 74 If StringRight($i, 1) = 0 Then $sData &= "Line " & $i & " " For $j = 1 to 13 $sData &= "Extended line " Next $sData &= @CRLF Else $sData &= "Line " & $i & @CRLF EndIf Next GUICtrlSetData($cLabel, $sData) GUISetState() _GUIScrollbars_Generate($hGUI, 1000, 1000) GUIRegisterMsg($WM_GESTURE, "_WM_GESTURE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _WM_GESTURE($hWnd, $Msg, $wParam, $lParam) Local $iX_1, $iY_1, $iX_2, $iY_2, $bPanning = False DllCall("User32.dll", "BOOL", "GetGestureInfo", "HANDLE", $lParam, "struct*", $pGesInfo) Switch DllStructGetData($tGesInfo, "dwID") Case 1 ; Gesture started $iX_1 = DllStructGetData($tGesInfo, "X") $iY_1 = DllStructGetData($tGesInfo, "Y") ConsoleWrite("+ Gesture started" & @CRLF) Case 2 ; Gesture ended - still scroll if panning If $bPanning Then ; Clear flag $bPanning = False ; Get final position $iX_2 = DllStructGetData($tGesInfo, "X") $iY_2 = DllStructGetData($tGesInfo, "Y") ; Scroll to final position __GestureScroll(DllStructGetData($tGesInfo, "hwndTarget"), $iX_1, $iY_1, $iX_2, $iY_2) ConsoleWrite("! Gesture ended" & @CRLF) EndIf Case 4 ; Set panning flag $bPanning = True ; Get current position $iX_2 = DllStructGetData($tGesInfo, "X") $iY_2 = DllStructGetData($tGesInfo, "Y") ; Scroll as required __GestureScroll(DllStructGetData($tGesInfo, "hwndTarget"), $iX_1, $iY_1, $iX_2, $iY_2) ; Set base for next call $iX_1 = $iX_2 $iY_1 = $iY_2 ConsoleWrite("- Gesture continued" & @CRLF) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_GESTURE Func __GestureScroll($hWnd, $iX_1, $iY_1, $iX_2, $iY_2) Local $iDirn ; Find window index Local $iIndex = -1 For $i = 0 To UBound($__g_aSB_WindowInfo) - 1 If $hWnd = $__g_aSB_WindowInfo[$i][0] Then $iIndex = $i Next If $i <> -1 Then ; Calculate lines to scroll Local $iX_Diff = Int(($iX_2 - $iX_1) / $__g_aSB_WindowInfo[$iIndex][2]) $iDirn = (($iX_Diff > 0) ? ($SB_LINELEFT) : ($SB_LINERIGHT)) ConsoleWrite("X scroll " & $iX_Diff & " lines" & @CRLF) For $i = 1 To Abs($iX_Diff) ; Scroll _SendMessage($hWnd, $WM_HSCROLL, $iDirn) Next ; Calculate lines to scroll Local $iY_Diff = Int(($iY_2 - $iY_1) / $__g_aSB_WindowInfo[$iIndex][3]) $iDirn = (($iY_Diff > 0) ? ($SB_LINEDOWN) : ($SB_LINEUP)) ConsoleWrite("Y scroll " & $iY_Diff & " lines" & @CRLF) For $i = 1 To Abs($iX_Diff) _SendMessage($hWnd, $WM_VSCROLL, $iDirn) Next EndIf EndFuncIf anyone else wants to join in the fun, then please do.M23 Edited September 30, 2015 by Melba23 Fixed code 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
TheDcoder Posted September 30, 2015 Posted September 30, 2015 Looks like you forgot a closing " (Quotation mark) EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
Moderators Melba23 Posted September 30, 2015 Author Moderators Posted September 30, 2015 TheDcoder,Thanks.M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Qwerty212 Posted September 30, 2015 Posted September 30, 2015 I'm in my Notsosmart phone, but I didn't wanted to wait 'till I arrive home to say thanks again for your effort. Greets from Barcelona
Qwerty212 Posted October 1, 2015 Posted October 1, 2015 (edited) Hi Melba, sorry for the delay.I've tested your last script.I've tried first to swipe from down to up (like you want to scroll down with a touch screen)Even with a very small movement of the finger the GUI scrolls to the bottom.This is what I get in the console:+Gesture startedx scroll 71 linesY scroll 24 lines-Gesture continued The image is from some other tests, so coordinates may differ, but the result is the same. Then I tried to scroll up doing a swipe from the upper part of the GUI to the lower one.+Gesture startedx scroll 68 linesY scroll 9 lines-Gesture continued+Gesture startedx scroll 68 linesY scroll 16 lines-Gesture continued+Gesture startedx scroll 68 linesY scroll 23 lines-Gesture continuedNothing happens. Neither the GUI content or the verticall scrollbar make any movement. If I try to scroll up or down (even I'm on the bottom of the GUI) the scrollbar makes some tiny movement up and the content fades to the upper side of the GUI (like if it is scrolling even more to down). As my English sucks I'll show an image to try to explain my self a little bit:If that happens and I try to scroll up directly moving the scrollbar then I just can not reach the top of the lines: Tryng to scroll repeatedly can drive to get all the content outside the screen:Trying to swipe horizontally doesn't trigger any event in the console or any scrolling in the GUI.I hope it helps.Greets from Barcelona Edited October 1, 2015 by Qwerty212
Moderators Melba23 Posted October 1, 2015 Author Moderators Posted October 1, 2015 Qwerty212,Thanks for that very comprehensive report - something to keep me occupied over the weekend when I am not flying!M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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