Nova Posted February 24, 2005 Share Posted February 24, 2005 (edited) 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 February 24, 2005 by Nova Link to comment Share on other sites More sharing options...
MHz Posted February 24, 2005 Share Posted February 24, 2005 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? Link to comment Share on other sites More sharing options...
phillip123adams Posted February 24, 2005 Share Posted February 24, 2005 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.expandcollapse popup#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 More sharing options...
jpm Posted February 25, 2005 Share Posted February 25, 2005 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now