FunkyBunnies Posted February 8, 2010 Posted February 8, 2010 (edited) Hey All,I've been wrestling with this issue for a while now and I'm confused why I seem to be the only one getting it even in all of the examples.it looks like the example WM_SIZE function doesn't take into account the previous scrollbar position and can incorrectly shift the page independant of where it was before scrolling. Am I doing something wrong? is this an easy fix? any help would be appreciated (try scrolling the vertical scrollbar all the way to the bottom then resize the window) Edited February 8, 2010 by FunkyBunnies
martin Posted February 8, 2010 Posted February 8, 2010 This is what I do to overcome the problem, at the start of the WM_SIZE function I add the line _GUIScrollBars_SetPos($hWnd,$SB_VERT, 0) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
FunkyBunnies Posted February 8, 2010 Author Posted February 8, 2010 thanks, Martin! that's a big help but I was wondering if there was a way to take into account the current position and recalculate based on that rather than moving the scroll back to 0 each time the user initiates a resize? I was surprised I couldn't find any example snippets for it but maybe it's so simple for other people that they don't bother posting it up haha
jeff93063 Posted March 4, 2010 Posted March 4, 2010 I'm right with you, buddy. I'm using Kip's GUIScroll UDF to simplify things, but this problem remains. I had to make it scroll to the top each time it is resized, otherwise the buttons started shifting down the page.expandcollapse popup#include<WindowsConstants.au3> #include<GuiconstantsEx.au3> #include <WinAPI.au3> #include "GUIScroll.au3" If Not IsDeclared('WM_MOUSEWHEEL') Then $WM_MOUSEWHEEL = 0x020A Global Const $iStep = 35 $main_window = GUICreate("eeee",640,480,"","",$WS_SIZEBOX+$WS_MAXIMIZEBOX+$WS_MINIMIZEBOX) GuiSetState() $clientSize=WinGetClientSize($main_window) $innerWidth=$clientSize[0] $innerHeight=$clientSize[1] global $scroll_area = GUICreate("Test",$innerWidth-120,$innerHeight,120,0,$WS_CHILD,"",$main_window) ;GUICtrlSetResizing(-1,$GUI_DOCKALL) global $numButtons = 50; Scrollbar_Create($scroll_area, $SB_VERT, $numButtons*35+5) Scrollbar_Step($iStep, $scroll_area, $SB_VERT) buildButtons() GUISetState() GUIRegisterMsg($WM_MOUSEWHEEL, 'WM_MOUSEWHEEL') GUIRegisterMsg($WM_SIZE, "_WM_SIZE") GUIRegisterMsg(0x0231, "_WM_ENTERSIZEMOVE") GUIRegisterMsg(0x0232, "_WM_EXITSIZEMOVE") While 1 $iScrollPos = Scrollbar_GetPos($scroll_area, $SB_VERT) If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Func WM_MOUSEWHEEL($hWnd, $iMsg, $iwParam, $ilParam) Local $iDelta = BitShift($iwParam, 16) If $iDelta > 0 Then _SendMessage($scroll_area, $WM_VSCROLL, $SB_LINEUP) Else _SendMessage($scroll_area, $WM_VSCROLL, $SB_LINEDOWN) EndIf ;msgbox(0,"",$iScrollPos) Return 'GUI_RUNDEFMSG' EndFunc Func _WM_SIZE() _SendMessage($scroll_area, $WM_VSCROLL, $SB_TOP) $clientSize=WinGetClientSize($main_window) $innerWidth=$clientSize[0] $innerHeight=$clientSize[1] WinMove($scroll_area,"",120,0,$innerWidth-120,$innerHeight) Scrollbar_Create($scroll_area, $SB_VERT, $numButtons*35+5) Scrollbar_Step($iStep, $scroll_area, $SB_VERT) EndFunc Func _WM_ENTERSIZEMOVE() GUISetStyle(-1,$WS_EX_COMPOSITED,$main_window) EndFunc Func _WM_EXITSIZEMOVE() GUISetStyle(-1,"",$main_window) EndFunc Func buildButtons() for $i = 1 to $numButtons GUICtrlCreateButton($i,5,5+($i-1)*35,150,30) GUICtrlSetResizing(-1,$GUI_DOCKTOP+$GUI_DOCKLEFT+$GUI_DOCKHEIGHT+$GUI_DOCKWIDTH) next EndFuncIt's kind of lame moving to the top each time the user resizes the window. My idea for a solution is to get the scroll position (using Scrollbar_GetPos()) at the start of resizing, scroll to the top to prevent problems, then scroll back down to the original position after resizing. The only problem is, I can't find a way to scroll to a specific location. Does anybody know how to do it?The other problem I have here is with the mouse scrolling. When you first run the script, mouse scrolling works great. It goes about 35 pixels per notch on the wheel. But after resizing, mouse scrolling becomes way too slow... about 1 pixel per notch. Anyone have suggestions on how to fix that?
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