lordicast Posted February 26, 2010 Posted February 26, 2010 This there a way to Scroll up and down GUI with mouse wheel without seeing scrollbars? expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Excel.au3> #include <Constants.au3> #include <ListViewConstants.au3> #include <WinAPI.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("", 260, 420, 417, 196);,$WS_POPUP) HotKeySet('{esc}', 'close') GUISetOnEvent($GUI_EVENT_CLOSE, "close") $start = 6 $end = 1137 Global $soul[10000] StartUP() While 1 Sleep(10) WEnd Func StartUP() $mo = 0 $n = 1 For $i = $start To $end Step 1 $soul[$n] = GUICtrlCreateButton($i, 0, $mo, 259, 49, $WS_GROUP) GUICtrlSetOnEvent(-1, "close") $mo = $mo + 52 $n = $n + 1 Next GUISetState(@SW_SHOW) EndFunc ;==>StartUP Func close() Exit EndFunc ;==>close Keep in mind this isnt full script just a duplication of problem, I want to scroll down this gui to see the rest of buttons. [Cheeky]Comment[/Cheeky]
Moderators Melba23 Posted March 1, 2010 Moderators Posted March 1, 2010 lordicast,Perhaps something along these lines:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 500, 200) $hUpButton = GUICtrlCreateButton("Up", 410, 10, 80, 30) $hDnButton = GUICtrlCreateButton("Down", 410, 60, 80, 30) GUISetState() $hChild = GUICreate("Child", 400, 400, 0, 0, $WS_POPUP) GUISetBkColor(0xFF0000, $hChild) For $i = 0 To 19 GUICtrlCreateLabel($i, 0, $i * 20, 100, 20) GUICtrlSetBkColor(-1, 0x00FF00) Next GUISetState() _WinAPI_SetParent($hChild, $hGUI) $iTop = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hUpButton _Up() Case $hDnButton _Down() EndSwitch WEnd Func _Up() If $iTop > -200 Then $iTop = $iTop - 20 WinMove($hChild, "", 0, $iTop) EndIf EndFunc Func _Down() If $iTop < 0 Then $iTop = $iTop + 20 WinMove($hChild, "", 0, $iTop) EndIf EndFuncI have never been able to get the MouseSetOnEvent UDF to work with my scroll wheel, but if it works with yours, then all you have to do is to set the correct function/event linkage and Robert is your mother's brother! 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 Â
kaotkbliss Posted March 1, 2010 Posted March 1, 2010 Here is some bits of code I pulled from a game I have been working on that registers mouse wheel movement. I don't know if it will be of any help... Global $mouseEvent Global $zoom = 0 $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", 14, "ptr", DllCallbackGetPtr(DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")), "hwnd", $hM_Module[0], "dword", 0) GUICreate("mouse") $mouse = GUICtrlCreateLabel($zoom, 1, 1, 20, 20) GUISetState(@SW_SHOW) While 1 If $mouseEvent = 120 Then zoom() $mouseEvent = 0 ElseIf $mouseEvent = -120 Then zoom() $mouseEvent = 0 EndIf WEnd Func zoom() If $mouseEvent = 120 Then $zoom -= 1 GUICtrlSetData($mouse, $zoom) EndIf If $mouseEvent = -120 Then $zoom += 1 GUICtrlSetData($mouse, $zoom) EndIf EndFunc ;==>zoom Func _Mouse_Proc($nCode, $wParam, $lParam) $mouseData = DllStructGetData(DllStructCreate("int X;int Y" & ";dword mouseData", $lParam), 3) If $wParam = 0x020A Then $mouseEvent = BitShift($mouseData, 16) EndFunc ;==>_Mouse_Proc 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
Moderators Melba23 Posted March 1, 2010 Moderators Posted March 1, 2010 kaotkbliss,Thanks for the code, but still no result for me. I have a OEM-installed mouse "suite" which sets the mouse parameters. I have never been able to register anything other than the 3 buttons - I can only imagine that the app does something to short-circuit the normal mouse procedures. I have lived like this for 3 years - I dare say I can manage a few more! 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 Â
kaotkbliss Posted March 1, 2010 Posted March 1, 2010 kaotkbliss,Thanks for the code, but still no result for me. I have a OEM-installed mouse "suite" which sets the mouse parameters. I have never been able to register anything other than the 3 buttons - I can only imagine that the app does something to short-circuit the normal mouse procedures. I have lived like this for 3 years - I dare say I can manage a few more! M23maybe it's time for a generic $5 mouse? lol 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
lordicast Posted March 1, 2010 Author Posted March 1, 2010 Here is some bits of code I pulled from a game I have been working on that registers mouse wheel movement. I don't know if it will be of any help... Global $mouseEvent Global $zoom = 0 $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", 14, "ptr", DllCallbackGetPtr(DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")), "hwnd", $hM_Module[0], "dword", 0) GUICreate("mouse") $mouse = GUICtrlCreateLabel($zoom, 1, 1, 20, 20) GUISetState(@SW_SHOW) While 1 If $mouseEvent = 120 Then zoom() $mouseEvent = 0 ElseIf $mouseEvent = -120 Then zoom() $mouseEvent = 0 EndIf WEnd Func zoom() If $mouseEvent = 120 Then $zoom -= 1 GUICtrlSetData($mouse, $zoom) EndIf If $mouseEvent = -120 Then $zoom += 1 GUICtrlSetData($mouse, $zoom) EndIf EndFunc ;==>zoom Func _Mouse_Proc($nCode, $wParam, $lParam) $mouseData = DllStructGetData(DllStructCreate("int X;int Y" & ";dword mouseData", $lParam), 3) If $wParam = 0x020A Then $mouseEvent = BitShift($mouseData, 16) EndFunc ;==>_Mouse_Proc WOW very useful the way it determines up and down will use this for alot of projects. On another note I might have to use this to delete controls and create to have the affect of scrolling. [Cheeky]Comment[/Cheeky]
kaotkbliss Posted March 1, 2010 Posted March 1, 2010 WOW very useful the way it determines up and down will use this for alot of projects. On another note I might have to use this to delete controls and create to have the affect of scrolling. Credit is due to BogQ as he is the one I got the original from I simply modified it 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
lordicast Posted March 1, 2010 Author Posted March 1, 2010 (edited) Hey Guys I got this one working this is how thanks all that helped he's a working snippet expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Excel.au3> #include <Constants.au3> #include <ListViewConstants.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <MouseSetOnEvent_UDF.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("", 260, 416, 417, 196) HotKeySet('{esc}', 'close') GUISetOnEvent($GUI_EVENT_CLOSE, "close") Global $mouseEvent Global $zoom = 0 $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", 14, "ptr", DllCallbackGetPtr(DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")), "hwnd", $hM_Module[0], "dword", 0) Dim $Last_soul $start = 6 $end = 1137 Global $soul[10000] StartUP() GUISetState(@SW_SHOW) While 1 Sleep(10) If $mouseEvent = 120 Then zoom() $mouseEvent = 0 ElseIf $mouseEvent = -120 Then zoom() $mouseEvent = 0 EndIf WEnd Func StartUP() $mo = 0 $n = 1 For $i = $start To $end Step 1 $soul[$n] = GUICtrlCreateButton($i, 0, $mo, 259, 49, $WS_GROUP) GUICtrlSetOnEvent(-1, "close") $mo = $mo + 52 $n = $n + 1 Next $Last_soul = $n EndFunc ;==>StartUP Func close() Exit EndFunc ;==>close Func zoom() If $mouseEvent = 120 Then $zoom -= 1 For $p = 1 To $Last_soul Step 1 $Cpos = ControlGetPos('', '', $soul[$p]) GUICtrlSetPos($soul[$p], 0, $Cpos[1] + 416) Next GUISetState(@SW_SHOW) EndIf If $mouseEvent = -120 Then $zoom += 1 For $p = 1 To $Last_soul Step 1 $Cpos = ControlGetPos('', '', $soul[$p]) GUICtrlSetPos($soul[$p], 0, $Cpos[1] - 416) Next GUISetState(@SW_SHOW) EndIf EndFunc ;==>zoom Func _Mouse_Proc($nCode, $wParam, $lParam) $mouseData = DllStructGetData(DllStructCreate("int X;int Y" & ";dword mouseData", $lParam), 3) If $wParam = 0x020A Then $mouseEvent = BitShift($mouseData, 16) EndFunc ;==>_Mouse_Proc Edited March 1, 2010 by lordicast [Cheeky]Comment[/Cheeky]
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