jaberwacky Posted January 17, 2012 Share Posted January 17, 2012 (edited) I have a window with a vertical scrollbar. The bottom of the window is cut off when you scroll down, minimize the window, and then restore the window. I have some screen shots that demonstrate this. I used Melba23's ScrollBar UDF which did alert me to another problem which I corrected. Because the UDF didn't seem to help with this problem I went back to my old scroll code which I lifted from the helpfile.Any ideas as to why this might happen?This is how it looks before:This is how it looks after:This is how it should look:Here is my scroll bar code just in case because I feel this is where the problem lies. I just realized that this probably isn't the problem because I took this from the helpfile and no one else seems to have an issue with it so far.expandcollapse popup#region - Scrollbar GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") _GUIScrollBars_Init($main_gui, 0, 40) #region -- Gui Register Messages Func WM_MOUSEWHEEL(Const $hWnd, Const $iMsg, Const $iwParam, Const $ilParam) #forceref $hwnd, $iMsg, $ilParam Local Const $iDelta = BitShift($iwParam, 16) If $iDelta > 0 Then _SendMessage($main_gui, $WM_VSCROLL, $SB_LINEUP) Else _SendMessage($main_gui, $WM_VSCROLL, $SB_LINEDOWN) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_MOUSEWHEEL Func WM_VSCROLL(Const $hWnd, Const $Msg, Const $wParam, Const $lParam) #forceref $Msg, $wParam, $lParam Local $index = -1 Local $yChar = '' Local Const $upbound =(UBound($aSB_WindowInfo) - 1) For $x = 0 To $upbound If $aSB_WindowInfo[$x][0] = $hWnd Then $index = $x $yChar = $aSB_WindowInfo[$index][3] ExitLoop EndIf Next If $index = -1 Then Return $GUI_RUNDEFMSG ; Get all the vertical scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) Local Const $yPos = DllStructGetData($tSCROLLINFO, "nPos") Local Const $nScrollCode = BitAND($wParam, 0x0000FFFF) Switch $nScrollCode Case $SB_TOP ; user clicked the HOME keyboard key Local Const $Min = DllStructGetData($tSCROLLINFO, "nMin") DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM ; user clicked the END keyboard key Local Const $Max = DllStructGetData($tSCROLLINFO, "nMax") DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos",($yPos - 1)) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos",($yPos + 1)) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box Local Const $Page1 = DllStructGetData($tSCROLLINFO, "nPage") DllStructSetData($tSCROLLINFO, "nPos",($yPos - $Page1)) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box Local Const $Page2 = DllStructGetData($tSCROLLINFO, "nPage") DllStructSetData($tSCROLLINFO, "nPos",($yPos + $Page2)) Case $SB_THUMBTRACK ; user dragged the scroll box Local Const $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch ; Set the position and then retrieve it. Due to adjustments by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ; If the position has changed, scroll the window and update it Local Const $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($hWnd, 0,($yChar *($yPos - $Pos))) Return $GUI_RUNDEFMSG EndFunc ;==>WM_VSCROLL #endregion -- Gui Register Messages #endregion - ScrollbarYes, I know I should just not minimize the window. Edited January 20, 2012 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
lark Posted January 17, 2012 Share Posted January 17, 2012 I don't know why that might happen, but if you have the script check the GUIGetMsg function for $GUI_EVENT_RESTORE (i think that's what it is), then just have the script completely re-do the scrollbars. Link to comment Share on other sites More sharing options...
jaberwacky Posted January 17, 2012 Author Share Posted January 17, 2012 Re-do them? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
lark Posted January 18, 2012 Share Posted January 18, 2012 Try having your script execute Melba23's scrollbar function each time the GUI windows is restored. That might solve it. Link to comment Share on other sites More sharing options...
jaberwacky Posted January 18, 2012 Author Share Posted January 18, 2012 That doesn't work, sorry. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
rover Posted January 19, 2012 Share Posted January 19, 2012 czardas came up with a solution to this: child GUI scrollbar breaks - when changing desktop background preferences expandcollapse popup;modified from a Melba23 scrollbar UDF example - GUIScrollbars_Size_Example_2.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIScrollBars.au3> #include <ScrollBarConstants.au3> #include "GUIScrollbars_Size.au3" #include <SendMessage.au3> Global $hGUI, $aRet $hGUI = GUICreate("Test", 300, 300) $aRet = _GUIScrollbars_Size(0, 550, 300, 300) _GUIScrollBars_Init($hGUI) _GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT, True) _GUIScrollBars_ShowScrollBar($hGUI, $SB_HORZ, False) _GUIScrollBars_SetScrollInfoPage($hGUI, $SB_VERT, $aRet[2]) _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_VERT, $aRet[3]) _Draw_Labels(10) GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_RESTORE _Refresh($hGUI) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Refresh($hWnd) _GUIScrollBars_ShowScrollBar($hWnd, $SB_BOTH, True) Local $nPos = _GUIScrollBars_GetScrollPos($hWnd, $SB_VERT) ; Get current position _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_VERT, 0) ; Set the scroll to zero ;Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) _GUIScrollBars_ShowScrollBar($hWnd, $SB_HORZ, False) ;_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO);seems to work without this _GUIScrollBars_SetScrollInfoPos($hWnd, $SB_VERT, $nPos) EndFunc Func _Draw_labels($iCount) GUISwitch($hGUI) For $i = 0 To 10 GUICtrlCreateLabel($i, 10, $i * 50 +10, 265, 40) GUICtrlSetBkColor(-1, 0xFF8080) GUICtrlSetFont(-1, 18) Next EndFunc ;==>_Draw_labels Func WM_MOUSEWHEEL(Const $hWnd, Const $iMsg, Const $iwParam, Const $ilParam) #forceref $hwnd, $iMsg, $ilParam Local Const $iDelta = BitShift($iwParam, 16) If $iDelta > 0 Then _SendMessage($hGUI, $WM_VSCROLL, $SB_LINEUP) Else _SendMessage($hGUI, $WM_VSCROLL, $SB_LINEDOWN) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_MOUSEWHEEL Func WM_VSCROLL(Const $hWnd, Const $Msg, Const $wParam, Const $lParam) #forceref $Msg, $wParam, $lParam Local $index = -1 Local $yChar = '' Local Const $upbound =(UBound($aSB_WindowInfo) - 1) For $x = 0 To $upbound If $aSB_WindowInfo[$x][0] = $hWnd Then $index = $x $yChar = $aSB_WindowInfo[$index][3] ExitLoop EndIf Next If $index = -1 Then Return $GUI_RUNDEFMSG ; Get all the vertical scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) Local Const $yPos = DllStructGetData($tSCROLLINFO, "nPos") Local Const $nScrollCode = BitAND($wParam, 0x0000FFFF) Switch $nScrollCode Case $SB_TOP ; user clicked the HOME keyboard key Local Const $Min = DllStructGetData($tSCROLLINFO, "nMin") DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM ; user clicked the END keyboard key Local Const $Max = DllStructGetData($tSCROLLINFO, "nMax") DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos",($yPos - 1)) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos",($yPos + 1)) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box Local Const $Page1 = DllStructGetData($tSCROLLINFO, "nPage") DllStructSetData($tSCROLLINFO, "nPos",($yPos - $Page1)) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box Local Const $Page2 = DllStructGetData($tSCROLLINFO, "nPage") DllStructSetData($tSCROLLINFO, "nPos",($yPos + $Page2)) Case $SB_THUMBTRACK ; user dragged the scroll box Local Const $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch ; Set the position and then retrieve it. Due to adjustments by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ; If the position has changed, scroll the window and update it Local Const $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($hWnd, 0,($yChar *($yPos - $Pos))) Return $GUI_RUNDEFMSG EndFunc ;==>WM_VSCROLL I see fascists... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 19, 2012 Moderators Share Posted January 19, 2012 rover, Hi there! I missed that the first time round - I will look to to see if I can get that into the UDF. 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 Link to comment Share on other sites More sharing options...
jaberwacky Posted January 19, 2012 Author Share Posted January 19, 2012 Excellent! Thank you to rover, czardas, Melba23, and mischieftoo. That works just fine! Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
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