Sign in to follow this  
Followers 0
jmiley

Horizontal Scrollbars with GUIScrollbars_Ex

7 posts in this topic

Hello all!

I've been creating a gui that has multiple windows. For the windows that I need vertical scrollbars I've been using the GUIScrollbars_Ex script. It has been working wonderfully!

Now I have a window which will need a horizontal scrollbar and I cannot figure out how to create them with this script. Any suggestions?

Thanks for your help!

Share this post


Link to post
Share on other sites



jmiley,

Welcome to the AutoIt forum. :unsure:

If that is my GUIScrollbars_Ex UDF to which you refer then it is not difficult - all you need to do is to define the $iH_Scroll parameter. Please post the script you are using and I will see if we can get you up and running! :>

If it is not my UDF, then still post the script and I will take a look. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Yes, it is your script Melba23. Let me re-iterate that it is wonderful and is easy to use.

I've attached your file and posted a working snippet of the gui that I've been working on. It's only 2 of the 30 windows I've done so far, but it contains one gui that has the vertical scroll bar and one with the non-working horizontal scrollbar (it does it as a vertical).

It's going to be a program to help seniors and other people who have not used a computer to learn how to use the mouse.

Thanks a lot for your quick response and help!

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

gui29()
Func gui29()
$Mousing_Around_29 = GUICreate("Mousing Around 29", 892, 721, 193, 155, $WS_MAXIMIZE)
GUISetFont(16, 400, 0, "Arial")
GUISetBkColor(0xFFFFFF)
For $i = 0 To 75
$Label1 = GUICtrlCreateLabel("Scroll Bars", 16, 16, 150, 36)
GUICtrlSetFont(-1, 20, 800, 0, "Arial")
GUICtrlSetColor(-1, 0xFF00FF)
$Label2 = GUICtrlCreateLabel("If your mouse has a wheel button, you can use it to scroll up and down. To use the wheel button, place your index or middle finger lightly on the wheel. Do not press down. Lightly pull the button towards you to move the page down. To move the page up, lightly push it away from you.", 216, 104, 650, 148)
$Label6 = GUICtrlCreateLabel("The great thing is if you're using the wheel button, the mouse does not have to be moved over to the scrollbars. Try it now!", 208, 256, 667, 68)
$Label4 = GUICtrlCreateLabel("Fourth (and Last) Way to Use the Scroll Bar:", 208, 72, 448, 28)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUICtrlSetColor(-1, 0xFF0000)
Next
$Pic2 = GUICtrlCreatePic("images\vertPenguins3.gif", 752, 448, 125, 630)
$Label8 = GUICtrlCreateLabel("Watch Out! You're now a scrolling expert!", 211, 1014, 460, 28)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUICtrlSetColor(-1, 0xFF0000)
$Pic1 = GUICtrlCreatePic("images\buttons.gif", 16, 72, 176, 150)
$Pic3 = GUICtrlCreatePic("images\vertPenguins1.gif", 16, 456, 125, 630)
$Pic4 = GUICtrlCreatePic("images\vertPenguins2.gif", 344, 368, 125, 630)
$Label3 = GUICtrlCreateLabel("Click here", 297, 1064, 97, 28)
GUICtrlSetFont(-1, 16, 400, 4, "Arial")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
$Label5 = GUICtrlCreateLabel("to continue.", 396, 1064, 113, 28)
_GUIScrollbars_Generate($Mousing_Around_29, 0, 0 + ($i * 20))
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Label3
            $Mousing_Around_29 = GuiDelete()
            gui30()     
    EndSwitch
WEnd
EndFunc
Func gui30()
$Mousing_Around_30 = GUICreate("Mousing Around 30", 909, 605, 230, 146, $WS_MAXIMIZE)
GUISetFont(16, 400, 0, "Arial")
GUISetBkColor(0xFFFFFF)
For $i = 0 To 75
$Label1 = GUICtrlCreateLabel("Scroll Bars", 16, 16, 150, 36)
GUICtrlSetFont(-1, 20, 800, 0, "Arial")
GUICtrlSetColor(-1, 0xFF00FF)
$Label4 = GUICtrlCreateLabel("Horizontal Scroll Bars", 32, 80, 221, 28)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Horizontal scroll bars will appear across the bottom of the window if the content is too wide to fit within the window. This allows you to move the content left and right. Find the horizontal scroll bar at the bottom of the window (in the area indicated by the moving hand). These horizontal bars work the same way vertical scroll bars do. Try the horizontal scroll bar now.", 32, 104, 650, 164)
$Label3 = GUICtrlCreateLabel("Click here", 1185, 400, 97, 28)
Next
$Pic1 = GUICtrlCreatePic("images\penguinshorizontal.gif", 584, 272, 638, 87)
GUICtrlSetFont(-1, 16, 400, 4, "Arial")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor (-1, 0)
$Label5 = GUICtrlCreateLabel("to continue.", 1284, 400, 113, 28)
_GUIScrollbars_Generate($Mousing_Around_30, 0, 0 + ($i * 20))
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Label3
            Exit
    EndSwitch
WEnd
EndFunc

jmiley,

Welcome to the AutoIt forum. :unsure:

If that is my GUIScrollbars_Ex UDF to which you refer then it is not difficult - all you need to do is to define the $iH_Scroll parameter. Please post the script you are using and I will see if we can get you up and running! :>

If it is not my UDF, then still post the script and I will take a look. ;)

M23

GuiScrollBars_Ex.au3

Share this post


Link to post
Share on other sites

jmiley,

As I suspected, you had not set the $iH_Scroll parameter - it was still set to 0 and you were still defining the $iV_Scroll parameter. Just change the relevant line to read: :>

_GUIScrollbars_Generate($Mousing_Around_30, 0 + ($i * 20))

A couple of other points:

- 1. Why the For...Next loops - is it to make the text flash a little? :unsure:

- 2. I needed to resize the "horizontal scroll" GUI to get the "Click me" label to be hidden initially - I would recommend using the @DesktopWidth and @DesktopHeight macros to size your GUIs and so ensure that you do not have this problem on larger screens. :D

I hope that helps. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Thanks Melba23 that did the trick for me.

1 - The flashing was driving me nuts. I've fixed it now. Thanks for that tidbit! When I originally created these pages, I copied and pasted from code I found on the forum and that's how it was in that snippet, so I never thought much else about it. It loads much faster, too.

2 - I didn't know about @DesktopWidth and @DesktopHeight, so thanks for letting me know. I just started using AutoIt last week to build this tutorial. I had been using autohotkey and found its gui quite restricting so I'm still learning about some of the things I can do with AutoIt.

Thanks again for your wonderful and prompt help.

jmiley

jmiley,

As I suspected, you had not set the $iH_Scroll parameter - it was still set to 0 and you were still defining the $iV_Scroll parameter. Just change the relevant line to read: :>

_GUIScrollbars_Generate($Mousing_Around_30, 0 + ($i * 20))

A couple of other points:

- 1. Why the For...Next loops - is it to make the text flash a little? :unsure:

- 2. I needed to resize the "horizontal scroll" GUI to get the "Click me" label to be hidden initially - I would recommend using the @DesktopWidth and @DesktopHeight macros to size your GUIs and so ensure that you do not have this problem on larger screens. :D

I hope that helps. ;)

M23

Share this post


Link to post
Share on other sites

Just an aside, you might want to change this line:

_GUIScrollbars_Generate($Mousing_Around_30, 0 + ($i * 20))

To this:

_GUIScrollbars_Generate($Mousing_Around_30, ($i * 20))

There's really no reason to add zero to the result of $i * 20, but of course it doesn't hurt anything doing it either. :unsure:


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

jmiley,

Glad I could help and pleased that you find the UDF useful. :unsure:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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