Sign in to follow this  
Followers 0
qwert

Can someone help with this scrollbar example?

5 posts in this topic

I'm still trying to learn about scroll bars -- and, so far, my test example doesn't exactly work.

#cs ----------------------------------------------------------------------------
    Create Parent and Child Windows, both with Scroll Bars.
#ce ----------------------------------------------------------------------------
#include <GuiConstants.au3>
$Parent = GUICreate("Parent", 400, 200, 200, 200, BitOR($WS_THICKFRAME, $WS_VSCROLL, $WS_HSCROLL, $WS_SYSMENU, $WS_CAPTION, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX))
GUISetState(@SW_SHOW, $Parent)
$Child = GuiCreate("Child", 600, 100, 0, 0, BitOR($WS_CHILD, $WS_THICKFRAME, $WS_VSCROLL, $WS_HSCROLL, $WS_CAPTION, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX), -1, $Parent)
GUICtrlCreateButton ( "Button1", 50, 10, 60, 20)
GUICtrlCreateButton ( "Button2", 50, 150, 60, 20)
GUISetState(@SW_SHOW, $Child)
GUISetState()
WinActivate($Parent)
MsgBox(64, "Finished", "Test, Then Click to Close!")
Exit

My questions are:

1. Why aren't the scrollbars active? (e.g., why can't I scroll the parent to view the child) -- what should I change?

2. What is the "right" way to make the windows visible? (GUISetState? WinActivate? ... something else?)

3. Where is my Button2?

Thanks for any help.

Share this post


Link to post
Share on other sites



I do appreciate your response -- and I have attempted to wade through GUIScrollBars.au3 for answers,

As a complete beginner, I developed this simple example to try to get to the bottom of these three issues -- and to express my (mis)understandings in a straightforward manner. I'm just trying to get my bearings.

Is anyone willing to answer my three questions?

Share this post


Link to post
Share on other sites

1. Why aren't the scrollbars active? (e.g., why can't I scroll the parent to view the child) -- what should I change?

I'm pretty sure the scrollbars will do nothing... unless you do something like this. (same link as first post)

2. What is the "right" way to make the windows visible? (GUISetState? WinActivate? ... something else?)

GUISetState(@SW_SHOW)... (default is the previously used window)

WinActivate will just give it focus

3. Where is my Button2?

It's there. When you resize the window... it moves.

Add...

GUICtrlSetResizing(-1, $GUI_DOCKALL)

...just under...

GUICtrlCreateButton ( "Button2", 50, 150, 60, 20)

... to prevent the control from moving.

Share this post


Link to post
Share on other sites

Thanks.

1. So there's no such thing as "system defaults" when you create a scrollbar? The scrollbar will just sit there until a DllStructureCreate is performed and, subsequently, some minimum subset of the parameters are filled in? Seems too complicated for what is one of the most basic elements of Windows -- but I guess it could be true. Is there some other way to define scrollbars so they come up active?

2. Now is see the difference.

3. Solved. It's and interesting effect to have the second button anchored and the first one floating.

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