Jump to content

Scroll Bars Inside GUI


Recommended Posts

I did some searching on the forums and didn't see an answer to this. I have also messed with examples from AutoIt, but i couldnt get it working.

The script below has many checkboxes and I want to add a lot more. The problem is that I run out of room in the GUI. I know I can expand the GUI window, but I want to keep it the same size and just add a scroll bar to scroll through the check boxes. Can anyone assist me or point me in a good direction?

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

HotKeySet("{ESC}", "EndScript")


#Region ### START Koda GUI section ### Form=D:\Frank's Documents\Auto-It Scripts Archive\Scripts in Devlopment\Form1.kxf
$Form1 = GUICreate("GUI WITH SCROLLBARS", 327, 370, 193, 125)

$Chk_1 = GUICtrlCreateCheckbox("1", 25, 10, 200, 15)
$Chk_2 = GUICtrlCreateCheckbox("2", 25, 30, 200, 15)
$Chk_3 = GUICtrlCreateCheckbox("3", 25, 50, 200, 15)
$Chk_4 = GUICtrlCreateCheckbox("4", 25, 70, 200, 15)
$Chk_5 = GUICtrlCreateCheckbox("5", 25, 90, 200, 15)
$Chk_6 = GUICtrlCreateCheckbox("6", 25, 110, 200, 15)
$Chk_7 = GUICtrlCreateCheckbox("7", 25, 130, 200, 15)
$Chk_8 = GUICtrlCreateCheckbox("8", 25, 150, 200, 15)
$Chk_9 = GUICtrlCreateCheckbox("9", 25, 170, 200, 15)
$Chk_10 = GUICtrlCreateCheckbox("10", 25, 190, 200, 15)
$Chk_11 = GUICtrlCreateCheckbox("11", 25, 210, 200, 15)
$Chk_12 = GUICtrlCreateCheckbox("12", 25, 230, 200, 15)
$Chk_13 = GUICtrlCreateCheckbox("13", 25, 250, 200, 15)

$btnok = GUICtrlCreateButton("OK", 1, 340, 75, 25)
GUISetState(@SW_SHOW)
$Checked_State = False


#EndRegion ### END Koda GUI section ###


While 1
    
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
        
    



    EndSwitch
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE

        Exit
    EndSwitch
WEnd
    
    





Func EndScript()
    
    Exit
    
EndFunc
Link to comment
Share on other sites

  • Moderators

MistakenSanity,

Welcome to the AutoIt forum. :)

Take a look at the ScrollBars UDF in my sig - you can do what you want with just 1 line of code. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

MistakenSanity,

Welcome to the AutoIt forum. :)

Take a look at the ScrollBars UDF in my sig - you can do what you want with just 1 line of code. ;)

M23

It appears I am really doing something wrong. I downloaded the zip file and put "GUIScrollbars_EX.au3" and "GUIScrollbars_Size.au3" into the "Include" folder in AutoIt's program folder. After I do that I tried to run your "GUIScrollbars_Ex_Example_1.au3 and get an error stating "Scrollbar generation failed"

Link to comment
Share on other sites

  • Moderators

MistakenSanity,

Try putting GUIScrollbars_Ex.au3 and GUIScrollbars_Size.au3 into the same folder as the examples and try then. :)

They do work, honest - I have just downloaded the zip file and tried for myself! :idiot:

M23

Edit:

Your script works for me like this:

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

#include <GUIScrollBars_Ex.au3>

HotKeySet("{ESC}", "EndScript")

Global $aChk[50]

#Region ### START Koda GUI section ### Form=D:\Frank's Documents\Auto-It Scripts Archive\Scripts in Devlopment\Form1.kxf
$Form1 = GUICreate("GUI WITH SCROLLBARS", 327, 370, 193, 125)


For $i = 0 To 49
    $aChk[$i] = GUICtrlCreateCheckbox("1", 25, 10 + ($i * 20), 200, 15)
Next

$btnok = GUICtrlCreateButton("OK", 1, 10 + ($i * 20), 75, 25)

GUISetState(@SW_SHOW)

$Checked_State = False

#EndRegion ### END Koda GUI section ###

_GUIScrollbars_Generate($Form1, 0, 45 + ($i * 20)) ; This is all you need, honest!!!!!


While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

Func EndScript()
    Exit
EndFunc

I hope it does for you too. ;)

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

MistakenSanity,

it worked perfectly

Good. Do come back if you need any help integrating the UDF into your script. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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