Sign in to follow this  
Followers 0
Anonymouse

Using WS_VScroll

9 posts in this topic

#1 ·  Posted (edited)

Since nobody had any ideas or input on my question about TreeView, I figured I could bypass this isue by taking all of the data and inserting it into a Group box, then seperating each section by Group Boxes inside the original Group Box. Alas, I have run into yet another problem I do not understand.

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Example", 316, 278, 347, 263)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 297, 193, $WS_VSCROLL)
$Combo1 = GUICtrlCreateCombo("Combo1", 16, 184, 145, 25)
$Combo2 = GUICtrlCreateCombo("Combo2", 16, 152, 145, 25)
$Combo3 = GUICtrlCreateCombo("Combo3", 16, 120, 145, 25)
$Combo4 = GUICtrlCreateCombo("Combo4", 16, 88, 145, 25)
$Combo5 = GUICtrlCreateCombo("Combo5", 16, 56, 145, 25)
$Combo6 = GUICtrlCreateCombo("Combo6", 16, 24, 145, 25)
GUICtrlCreateGroup("", -999, -999, 1, 1)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Why does the group box vscrollbar not work? Instead it just sets combo boxes outside of it, even though I am attempting to create them within the group box. I know I'm doing something simple and wrong but, again I do not understand.

[EDIT]I've tried a few other things and did some extensive searching... I must be doing it wrong because I don't see my problem coming up anywhere... GUI is a pain in my arse. I liked when I understood AutoIt, heh, I still have v2.64 when it came with the decom- yeah. Any input would be great, even if its just to call me an idiot for not understanding what I'm doing wrong[EDIT]

Edited by Anonymouse

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)

Share this post


Link to post
Share on other sites



Since nobody had any ideas or input on my question about TreeView, I figured I could bypass this isue by taking all of the data and inserting it into a Group box, then seperating each section by Group Boxes inside the original Group Box. Alas, I have run into yet another problem I do not understand.

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Example", 316, 278, 347, 263)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 297, 193, $WS_VSCROLL)
$Combo1 = GUICtrlCreateCombo("Combo1", 16, 184, 145, 25)
$Combo2 = GUICtrlCreateCombo("Combo2", 16, 152, 145, 25)
$Combo3 = GUICtrlCreateCombo("Combo3", 16, 120, 145, 25)
$Combo4 = GUICtrlCreateCombo("Combo4", 16, 88, 145, 25)
$Combo5 = GUICtrlCreateCombo("Combo5", 16, 56, 145, 25)
$Combo6 = GUICtrlCreateCombo("Combo6", 16, 24, 145, 25)
GUICtrlCreateGroup("", -999, -999, 1, 1)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Why does the group box vscrollbar not work? Instead it just sets combo boxes outside of it, even though I am attempting to create them within the group box. I know I'm doing something simple and wrong but, again I do not understand.

[EDIT]I've tried a few other things and did some extensive searching... I must be doing it wrong because I don't see my problem coming up anywhere... GUI is a pain in my arse. I liked when I understood AutoIt, heh, I still have v2.64 when it came with the decom- yeah. Any input would be great, even if its just to call me an idiot for not understanding what I'm doing wrong[EDIT]

I don't know how to have a group with scrollbars unless you make a child window like this, though it doesn't look the same.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
    Local $GUIMsg, $hGUI, $h_cGUI, $m

    $hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
    GUICtrlCreateLabel("comboboxes", 17, 6, 70, 12)
    
    $h_cGUI = GUICreate("Child GUI", 200, 200, 10, 20, BitOR($WS_BORDER, $WS_CHILD), -1, $hGUI);$WS_EX_CLIENTEDGE
    GUICtrlCreateButton("a button", 10, 10, 90, 20)
;GUISetBkColor(0X006400)
    For $m = 0 To 20
        GUICtrlCreateCombo($m, 10, 10 + $m * 30, 170, 22)
    Next
    
    
    GUISetState()
    GUICtrlSetResizing($h_cGUI, $GUI_DOCKALL)

    GUISwitch($hGUI)



    GUISwitch($hGUI)

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
    GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
    
    GUISetState()

    _GUIScrollBars_Init($h_cGUI)
    
    _GUIScrollBars_ShowScrollBar($h_cGUI, $SB_HORZ, False)
    _GUIScrollBars_SetScrollInfoMax($h_cGUI, $SB_VERT, 38)

    While 1
        $GUIMsg = GUIGetMsg()

        Switch $GUIMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    Exit
EndFunc  ;==>_Main

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
    
; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient
    
; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    
; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_SIZE

Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

    Local $index = -1, $xChar, $xPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xChar = $aSB_WindowInfo[$index][2]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0
    
;~ ; Get all the horizontal scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
    $xPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $xPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $Min, $Max
    Switch $nScrollCode

        Case $SB_LINELEFT; user clicked left arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINERIGHT; user clicked right arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGELEFT; user clicked the scroll bar shaft left of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGERIGHT; user clicked the scroll bar shaft right of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK; user dragged the scroll box
            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_HORZ, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_HSCROLL

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0


; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK; user dragged the scroll box
            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
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc  ;==>WM_VSCROLL

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.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I don't know how to have a group with scrollbars unless you make a child window like this, though it doesn't look the same.

...

Well, I was going to make a child window anyway and use tabs (tabintab, i believe aec made the script that I found w/ search) instead, for the sake of organization and looking pleasing to the eye. (still think the tree would look better :))

But alas, I still had the problem of the scroll not working. I will check this script, haven't tested everything yet. I also was attempting to use the UDF gary wrote for scrolling, But for some reason, again I must be doing something wrong. I keep getting this message that I'm not including all of the right UDF's (undefined variables, or unknown functions.)

I just feel really stupid at the moment. Sorry for so many posts on the forum. I JUST WANNA GRADUATE FROM NOOB TO SEMI-NOOB! :)

[EDIT] Martin.. I just want to say, I've seen you're posts with helping people on 75% of the threads I've read via Search. I don't think anyone has told you this yet.. but I love you. Thank you so very much. Now I shall make a very hard attempt to decipher this and actually understand everything and where I was going wrong.[/EDIT]

Edited by Anonymouse

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)

Share this post


Link to post
Share on other sites

Well, I was going to make a child window anyway and use tabs (tabintab, i believe aec made the script that I found w/ search) instead, for the sake of organization and looking pleasing to the eye. (still think the tree would look better :))

But alas, I still had the problem of the scroll not working. I will check this script, haven't tested everything yet. I also was attempting to use the UDF gary wrote for scrolling, But for some reason, again I must be doing something wrong. I keep getting this message that I'm not including all of the right UDF's (undefined variables, or unknown functions.)

I just feel really stupid at the moment. Sorry for so many posts on the forum. I JUST WANNA GRADUATE FROM NOOB TO SEMI-NOOB! :)

[EDIT] Martin.. I just want to say, I've seen you're posts with helping people on 75% of the threads I've read via Search. I don't think anyone has told you this yet.. but I love you. Thank you so very much. Now I shall make a very hard attempt to decipher this and actually understand everything and where I was going wrong.[/EDIT]

Wow, an Anonymouse lover!

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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ah, I said 'I love you' not that I'm 'in love with you', mate. Great thing to say to someone you've just slept with, really throws them for a loop.

(Catch the american vs english pun on word? bah. :))

Back on topic, I will prove that I am trying.. I don't know how stupid this will make me look. But why does this not work, and what am I missing or thinking of wrong? (I left notes on every line to explain what I think it means initially.)

; Including UDF's to declare variables and functions for commands
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <TabConstants.au3>
#include <StaticConstants.au3>

Opt("Mustdeclarevars", 1);Must declare variables, true
Global $nMsg
; A function to be defined later in script. I assume "()" is for other parameters?
_Main()

;Writing the function "_Main()" And declaring what actions to take when you call "_Main()" As in the previous line
Func _Main()
;Declaring variables 'Local' to the defined function as oppossed to 'Global' for the entire script
    Local $GUIMsg, $hGUI, $h_cGUI, $m, $hTAB, $TabSheet1, $TabSheet2, $TabSheet3
; Variable = Function("Title", Width, Height, Left[centered], Top[centered], Don't Quite Understand "BitOr" I assume it means default OR(Has minimize box, Has Caption, Is a popup window, Has system menu on title bar)
$hGUI = GUICreate("Example Attempt", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
; Variable = Function(Centered left, Centered top, Width, Height)
$hTAB = GUICtrlCreateTab(-1, -1, 375, 375)
; Function (Default of Set Height&Width, Dock width & Height) Make window unable to be resized 
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!! THIS IS WHERE EVERYTHING USUALLY GOES HAYWIRE !!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1"); Create a TabItem with the title 'TabSheet1'
    $h_cGUI = GUICreate("Child GUI", 200, 200, -1, -1, BitAND($WS_BORDER, $WS_CHILD), -1, $hTAB); Create A Child Inside Of a Child
; Now I will attempt to make 20 combo boxes inside this child

        For $m = 0 To 20; FOR Variable = Initial integer TO Final integer
    ; Create Combo Box(Titled Variable, 10 pixels from left, 10 pixels from top & Variable[0-20] * Width, Height(total), Don't know what this is)
        GUICtrlCreateCombo($m, 10, 10 + $m * 30, 170, 22) 
    Next; After Combo Boxes are created, go to next step in script
    
    $TabSheet2 = GUICtrlCreateTabItem("TabSheet2"); Create Tab 2
    $TabSheet3 = GUICtrlCreateTabItem("TabSheet3"); And 3
GUICtrlCreateTabItem(""); Close out Create Tab

GUISwitch($hGUI, $TabSheet1);Switches to Tab1 on the parent window

    GUIRegisterMsg($WM_SIZE, "WM_SIZE"); Registers $WM_Size as a UDF
    GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL"); ""
    GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL"); ""
    
    GUISetState(); I don't understand why "()" is empty
        _GUIScrollBars_Init($h_cGUI); Initializing scrollbars to the child in Tab1
        _GUIScrollBars_ShowScrollBar($h_cGUI, $SB_HORZ, False); In the Child inside Tab1 The Horizontal scrollbar is not shown
        _GUIScrollBars_SetScrollInfoMax($h_cGUI, $SB_VERT, 38); In the child inside Tab1 the maximum scroll (vertically) is 38 items?

GUISetState(@SW_SHOW); Show the window in its specified state


EndFunc; Close out Function _Main()

; Create an infinite loop (1=true) Close app when the exit button is pressed
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
        
;;;;;;;;;;;;;;;Have not edited anything below this line.
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
    
; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient
    
; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    
; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE

Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

    Local $index = -1, $xChar, $xPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xChar = $aSB_WindowInfo[$index][2]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0
    
;~; Get all the horizontal scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
    $xPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $xPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $Min, $Max
    Switch $nScrollCode

        Case $SB_LINELEFT; user clicked left arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINERIGHT; user clicked right arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGELEFT; user clicked the scroll bar shaft left of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGERIGHT; user clicked the scroll bar shaft right of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK; user dragged the scroll box
            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_HORZ, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
    Return $GUI_RUNDEFMSG
EndFunc ;==>WM_HSCROLL

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0


; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK; user dragged the scroll box
            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
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc ;==>WM_VSCROLL

Thanks for whoever helps me out with this headache.

[EDIT1] It's much easier to read if you put it in scite, ah the color, oh so pleasing to the eyes.[/EDIT1]

[EDIT2] Found my error with parameters, fixed it, and posted updated script - still not working :)[/EDIT2]

Edited by Anonymouse

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)

Share this post


Link to post
Share on other sites

But why does this not work, and what am I missing or thinking of wrong? (I left notes on every line to explain what I think it means initially.)

Adding to your headaches, can you post something which will run?

A bit more explanation about what goes wrong?. (Couldn't find "Goes Haywire" in the Help.)


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.

Share this post


Link to post
Share on other sites

Adding to your headaches, can you post something which will run?

A bit more explanation about what goes wrong?. (Couldn't find "Goes Haywire" in the Help.)

Sorry about that, mate. Okay, I understand why the parameters wouldn't work. But, why does it only show TabSheet1, and why does it not even show the child in TabSheet1. I even closed out the tab item definition with "GUICtrlCreateTabItem("")" just like the readme says to do.

BTW, updated script in previous post.

BTW2, hay·wire (hā'wīr')

adj. Informal

1. Mentally confused or erratic; crazy: went haywire over the interminable delays.

2. Not functioning properly; broken. ; How I meant to use the term, although now that I think about it - it is functioning exactly how I told it to, maybe my ability to create what I want is what I should actually be refering to as 'haywire'

Anyway, Even changing line 29, to

$h_cGUI = GUICreate("Child GUI", 200, 200, -1, -1, BitAND($WS_BORDER, $WS_CHILD), -1, $TabSheet1)

From

$h_cGUI = GUICreate("Child GUI", 200, 200, -1, -1, BitAND($WS_BORDER, $WS_CHILD), -1, $hTab)

Doesn't work. And, the program also lags when closing out and flashes relentlessly while becoming unresponsive. If it's worth any points, I am trying :)


children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)

Share this post


Link to post
Share on other sites

Sorry about that, mate. Okay, I understand why the parameters wouldn't work. But, why does it only show TabSheet1, and why does it not even show the child in TabSheet1. I even closed out the tab item definition with "GUICtrlCreateTabItem("")" just like the readme says to do.

BTW, updated script in previous post.

BTW2, hay·wire (hā'wīr')

adj. Informal

1. Mentally confused or erratic; crazy: went haywire over the interminable delays.

2. Not functioning properly; broken. ; How I meant to use the term, although now that I think about it - it is functioning exactly how I told it to, maybe my ability to create what I want is what I should actually be refering to as 'haywire'

Anyway, Even changing line 29, to

$h_cGUI = GUICreate("Child GUI", 200, 200, -1, -1, BitAND($WS_BORDER, $WS_CHILD), -1, $TabSheet1)

From

$h_cGUI = GUICreate("Child GUI", 200, 200, -1, -1, BitAND($WS_BORDER, $WS_CHILD), -1, $hTab)

Doesn't work. And, the program also lags when closing out and flashes relentlessly while becoming unresponsive. If it's worth any points, I am trying :)

Try this. Still needs some work but it's better.

; Including UDF's to declare variables and functions for commands
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <TabConstants.au3>
#include <StaticConstants.au3>
Global $GUIMsg, $hGUI, $h_cGUI, $m, $hTAB, $TabSheet1, $TabSheet2, $TabSheet3
Opt("Mustdeclarevars", 1);Must declare variables, true
Global $nMsg
; A function to be defined later in script. I assume "()" is for other parameters?
_Main()

;Writing the function "_Main()" And declaring what actions to take when you call "_Main()" As in the previous line
Func _Main()
;Declaring variables 'Local' to the defined function as oppossed to 'Global' for the entire script-no these are used outside the function and so must be Global

; Variable = Function("Title", Width, Height, Left[centered], Top[centered], Don't Quite Understand "BitOr" I assume it means default OR(Has minimize box, Has Caption, Is a popup window, Has system menu on title bar)
$hGUI = GUICreate("Example Attempt", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
; Variable = Function(Centered left, Centered top, Width, Height)
$hTAB = GUICtrlCreateTab(-1, -1, 375, 375)
; Function (Default of Set Height&Width, Dock width & Height) Make window unable to be resized
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!! THIS IS WHERE EVERYTHING USUALLY GOES HAYWIRE !!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1"); Create a TabItem with the title 'TabSheet1'
;

$TabSheet2 = GUICtrlCreateTabItem("TabSheet2"); Create Tab 2
$TabSheet3 = GUICtrlCreateTabItem("TabSheet3"); And 3
GUICtrlCreateTabItem(""); Close out Create Tab
$h_cGUI = GUICreate("Child GUI", 200, 200, -1, -1, BitAND($WS_BORDER, $WS_CHILD), -1, $hGUI); Create A Child Inside Of a Child
;
; Now I will attempt to make 20 combo boxes inside this child

For $m = 0 To 20; FOR Variable = Initial integer TO Final integer
; Create Combo Box(Titled Variable, 10 pixels from left, 10 pixels from top & Variable[0-20] * Width, Height(total), Don't know what this is)
    GUICtrlCreateCombo($m, 10, 10 + $m * 30, 170, 22)
Next; After Combo Boxes are created, go to next step in script

GUISwitch($hGUI)
;GUISwitch($hGUI, $TabSheet1);Switches to Tab1 on the parent window

GUIRegisterMsg($WM_SIZE, "WM_SIZE"); Registers $WM_Size as a UDF
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL"); ""
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL"); ""

;   GUISetState(); I don't understand why "()" is empty
; GUISetState(@SW_SHOW,$h_cGUI)

GUISetState(@SW_SHOW); Show the window in its specified state
GUISetState(@SW_SHOW, $h_cGUI)
_GUIScrollBars_Init($h_cGUI); Initializing scrollbars to the child in Tab1
_GUIScrollBars_ShowScrollBar($h_cGUI, $SB_HORZ, False); In the Child inside Tab1 The Horizontal scrollbar is not shown
_GUIScrollBars_SetScrollInfoMax($h_cGUI, $SB_VERT, 38); In the child inside Tab1 the maximum scroll (vertically) is 38 items? 38 lines of text worth

EndFunc; Close out Function _Main()

; Create an infinite loop (1=true) Close app when the exit button is pressed
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hTAB
            Switch GUICtrlRead($hTAB)
                Case 0

                    GUISetState(@SW_SHOW, $h_cGUI)

                Case 1, 2
                    GUISetState(@SW_HIDE, $h_cGUI)
            EndSwitch
    EndSwitch
WEnd

;;;;;;;;;;;;;;;Have not edited anything below this line.
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_SIZE

Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

    Local $index = -1, $xChar, $xPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xChar = $aSB_WindowInfo[$index][2]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

;~; Get all the horizontal scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
    $xPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $xPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $Min, $Max
    Switch $nScrollCode

        Case $SB_LINELEFT; user clicked left arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINERIGHT; user clicked right arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGELEFT; user clicked the scroll bar shaft left of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGERIGHT; user clicked the scroll bar shaft right of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK; user dragged the scroll box
            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_HORZ, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_HSCROLL

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0


; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK; user dragged the scroll box
            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
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc  ;==>WM_VSCROLL

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.

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