Jump to content

Scrolling Gui's


Nova
 Share

Recommended Posts

Im trying to figure out how to make a Gui which can be scrolled vertically.

The following code sets to many buttons onto a gui and the last one the 5th button is not visible.

I want to be able to click the vertical scroll bar so that the Gui scrolls and the 5th button is visible.

#include <GuiConstants.au3>

Dim $i = 1
Dim $Button_Y_Pos = 60

GuiCreate("MyGUI", 600, 500, -1, -1, $WS_VSCROLL )

Do
    $Button = GuiCtrlCreateButton( $i, 50, $Button_Y_Pos, 50, 50, $BS_ICON)
    $i = $i + 1    
    $Button_Y_Pos = $Button_Y_Pos + 120
Until $i = 5

GuiSetState()

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

How could I do this ?

Edited by Nova
Link to comment
Share on other sites

Im trying to figure out how to make a Gui which can be scrolled vertically.

<{POST_SNAPBACK}>

Nova,

I don't know how to use the window scroll bar, but here's your concept GUI using a slider. If you know how to read the window scroll bar, that would be nice.

#include <GuiConstants.au3>

Dim $i = 1
Dim $Button_Y_Pos = 60

;GUICreate("MyGUI", 600, 500, -1, -1, $WS_VSCROLL)
GUICreate("MyGUI", 600, 500, -1, -1)
$Slider = GUICtrlCreateSlider(580, 0, 30, 500, $TBS_VERT)
GUICtrlSetLimit(-1,500,-500)
GUICtrlSetData(-1, 0)

Local $aPos[6][2]

Do
;   Assign("Button" & $i, GUICtrlCreateButton("", 50, $Button_Y_Pos, 50, 50, $BS_ICON), 2)
   Assign("Button" & $i, GUICtrlCreateButton("Button" &$i, 50, $Button_Y_Pos, 50, 50), 2)
   $aPos[$i][0] = 50
   $aPos[$i][1] = $Button_Y_Pos
   $i = $i + 1
   $Button_Y_Pos = $Button_Y_Pos + 120
Until $i = 5
$iButtonCount = $i - 1

GUISetState()

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      case $msg = $Slider
         $iY_Offset = GUICtrlRead($Slider)
         $i = 1
         Do
            GUICtrlSetPos(eval("Button" & $i), $aPos[$i][0], $aPos[$i][1] + $iY_Offset)
            $i = $i + 1
         Until $i = $iButtonCount + 1
      Case Else
        ;;;
   EndSelect
WEnd
Exit

Phillip

Link to comment
Share on other sites

You cannot scroll a gui.

You can scroll a control.

I have never seen a scrolling control with a button yet?

M$ Gui have it all, and when you see that they do not do it. Well, what to think?

But, I maybe wrong?

<{POST_SNAPBACK}>

You are not wrong, only control can have scrollbar if they are design to as "Edit" for instance :lmao:
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...