Sign in to follow this  
Followers 0
lordicast

Scroll Gui Without Bars

9 posts in this topic

This there a way to Scroll up and down GUI with mouse wheel without seeing scrollbars?

#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]

Share this post


Link to post
Share on other sites



Anyone?


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

lordicast,

Perhaps something along these lines:

#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

EndFunc

I 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! :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

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 game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

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

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

 

Share this post


Link to post
Share on other sites

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

I have lived like this for 3 years - I dare say I can manage a few more! :(

M23

maybe it's time for a generic $5 mouse? lol


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

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


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

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 :mellow:

I simply modified it


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Hey Guys I got this one working this is how thanks all that helped he's a working snippet

#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 by lordicast

[Cheeky]Comment[/Cheeky]

Share this post


Link to post
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
Sign in to follow this  
Followers 0