Jump to content

is this normal i see some extra window space with scroll bar


Recommended Posts

guys, i am using a gui and wm_VSCROLL command registered as extracted from the help file )UDFs3.chm and i have about 2 inches blank space which i dont want to appear is this normal or am i wrong somewhere, u can check the help file there is a gap below the last control and i dont want that happen. i tried another sample fromelsewhere i get teh same when i apply to my code.

sorry for not posting the code. if the help file situation doesnt apply, i can post my code here.

Link to comment
Share on other sites

one more thing, i am actually populating a list of check boxed rows and if i skip that stage i would get only two buttons at the bottom in that case also i see a lot of wasted space - imean the scroll bar is not self hiding like we can control in edit boxes :-( is this normal or am i missing something , coz i am not used to wm_command operations and i just like the dll calls, i am scared because of the ignorance i get stuck when i try ...

Link to comment
Share on other sites

one more thing, i am actually populating a list of check boxed rows and if i skip that stage i would get only two buttons at the bottom in that case also i see a lot of wasted space - imean the scroll bar is not self hiding like we can control in edit boxes :-( is this normal or am i missing something , coz i am not used to wm_command operations and i just like the dll calls, i am scared because of the ignorance i get stuck when i try ...

Which example in the help are you referring to ?

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.
Link to comment
Share on other sites

sorry for not being descriptive. _GUIScrollBars_Init.au3 is the file i checked and that has only a little blank space below but this one : gui with scrollbar

I don't know which example in that thread you mean but I think I understand what you're worried about. The empty space you are referring to is simply that the scrollable range has been set too large.

The scrollbar functions are a bit confusing IMO because the units used for scrolling are based on the average size of a character. This is sensible if you are scrolling an edit box where you want to scroll completed lines, but otherwise I find it inconvenient and I prefer to have units of 1 pixel. Kip made a nice udf for scrollbars which you should look at because it can make using scrollbars a lot easier.

Below I have copied a chunk of code from the scrollbars.au udf to get the size used for the vertical increment. Then I have calculated the number of pixels for the scrollable range and divided by the vertical increment. It still doesn't give an exact fit but it's near, and experimenting shows that 98 instead of 99*30 fits very well.

#include <GuiScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>

Const $LINESTEP = 10
Const $PAGESTEP = 25
Dim $iPos = 0

GUIRegisterMsg($WM_VSCROLL, 'OnVertScroll')

Dim $hGUI = GUICreate('Test', 100, 200)
Dim $avButton[100]

For $i = 0 To 99
    $avButton[$i] = GUICtrlCreateButton('Button ' & $i+1, 20, 20+$i*30, 60, 25)
Next

Dim $hVScroll = _GUIScrollBars_Init($hGUI, 100)
_GUIScrollBars_SetScrollRange($hGUI, $SB_VERT, 0, (20 + 99*30 +25)/GetscrollVertInc($hGui));range set here
_GUIScrollBars_ShowScrollBar($hGUI, $SB_HORZ, False)

GUISetState()

Do
Until GUIGetMsg() = -3

GUIDelete()

Func OnVertScroll($hwnd, $iMsg, $iwParam, $ilParam)
    Local $iScrollCode = BitAND($iwParam, 0xFFFF)
    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
    Switch $iScrollCode
        Case $SB_LINEDOWN
            $iPos += $LINESTEP
        
        Case $SB_LINEUP
            $iPos -= $LINESTEP
            
        Case $SB_PAGEDOWN
            $iPos += $PAGESTEP
            
        Case $SB_PAGEUP
            $iPos -= $PAGESTEP
    EndSwitch
    
    If $iPos > 200 Then
        $iPos = 200
    ElseIf $iPos < 0 Then
        $iPos = 0
    EndIf
    
    _GUIScrollBars_SetScrollInfoPos($hGUI, $SB_VERT, $iPos)
EndFunc


func GetscrollVertInc($hWnd)

    Local $tTEXTMETRIC = DllStructCreate($tagTEXTMETRIC)

    Local $hdc = DllCall("User32.dll", "hwnd", "GetDC", "hwnd", $hWnd)
    $hdc = $hdc[0]

    DllCall("gdi32.dll", "int", "GetTextMetrics", "int", $hdc, "ptr", DllStructGetPtr($tTEXTMETRIC))

    $yChar = DllStructGetData($tTEXTMETRIC, "tmHeight") + DllStructGetData($tTEXTMETRIC, "tmExternalLeading")
    DllCall("User32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "hwnd", $hdc)

    return $yChar
EndFunc
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.
Link to comment
Share on other sites

precisely, that was my concern and at the moment i have had to switch to tabbed interface rather than scrollable :-(

i felt that it had something to do with the scroll range division but i couldnt actually figure out how to control it properly, i tried changing various values but the best i got was looking good when there was enough rows but if there is too little no. of rows i should be able to get the scroll bar not moving at all , but it would still move. i.e., more the display size is greater than the visible window size, it works better but that wasnt the point.

just like we control list boxes i wanted a complete control as to whether or not the scroll bar remains active . i will try ur example and the udf mentioned . i did search for scroll and obviously i got tooo many results and i was able to go through only a few of them.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...