Jump to content

Why won't my scroll bars work?


qwert
 Share

Recommended Posts

I'm trying to create a child window inside a parent window -- both with scroll bars. The scroll bars get created properly, but they won't scroll. In this code example, I simply want to scroll the parent window to be able to view all parts of the child window. The minimize and maximize buttons work fine. Is there something wrong with the way the scroll bars are defined? Or is another step required to activate them?

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.8.1
 Author:         qwert

 Script Function:
    Create Parent and Child Windows, both with Scroll Bars.

#ce ----------------------------------------------------------------------------
#include <GuiConstants.au3>
; Script Start 
$Parent = GUICreate("Parent", 400, 200, 200, 200, BitOR($WS_VSCROLL, $WS_HSCROLL, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX))
GUISetState(@SW_SHOW, $Parent)
$Child = GuiCreate("Child", 600, 100, 0, 0, BitOR($WS_CHILD, $WS_VSCROLL, $WS_SYSMENU, $WS_CAPTION, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX), -1, $Parent)
GUISetState(@SW_SHOW, $Child)
MsgBox(64, "Finished", "Test, Then Click to Close!")
Exit

Thanks for any help. (As you can probably tell, I'm new at this.)

Link to comment
Share on other sites

Hello! I`m hope, what understand you correct. :P

Example:

#include <GuiConstants.au3>

$Parent = GUICreate("Parent", 300, 200)
$button = GUICtrlCreateButton("Child", 10, 10, 50, 25)

$Child = GUICreate("Child", 200, 100, -1, -1, Default, Default, $Parent)

GUISetState(@SW_SHOW, $Parent)

While 1
    $msg = GUIGetMsg(1)
    Select
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $Parent
        Exit
    Case $msg[0] = $button
        GUISetState(@SW_DISABLE, $Parent)
        GUISetState(@SW_SHOW, $Child)
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $Child
        GUISetState(@SW_ENABLE, $Parent)
        GUISetState(@SW_HIDE, $Child)
    EndSelect
WEnd
Link to comment
Share on other sites

Sorry, but your example has no scroll bars at all. My question is only about scroll bars:

Is there something wrong with the way the scroll bars are defined? Or is another step required to activate them?

Can anyone tell me what the problem is with MY code example?
Link to comment
Share on other sites

Sorry, but your example has no scroll bars at all. My question is only about scroll bars:

Can anyone tell me what the problem is with MY code example?

I don't know what the problem is, but it has nothing to do with the child window. Removing the child still leaves the parent GUI scroll bars not working:

#include <GuiConstants.au3>
; Script Start
$Parent = GUICreate("Parent", 400, 200, 200, 200, BitOR($WS_VSCROLL, $WS_HSCROLL, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX))
GUICtrlCreateEdit("", 10, 10, 500, 300)
GUISetState(@SW_SHOW, $Parent)
;$Child = GUICreate("Child", 600, 100, 0, 0, BitOR($WS_CHILD, $WS_VSCROLL, $WS_SYSMENU, $WS_CAPTION, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX), -1, $Parent)
;GUISetState(@SW_SHOW, $Child)

Do
    Sleep(20)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thanks for the references. I had looked at them previously and found them too much for me to cope with at this point (as a novice) -- which is why I worked up my simple example.

Is there no way to add a step or two to what I have to make it work? Or are scroll bars considered just plain complicated?

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