Jump to content

Scrollbars Made Easy - New version 27 Jan 22


Melba23
 Share

Recommended Posts

  • Moderators

Siwa,

My thought was to load the names from the Excel file into a simple ListView - then Windows looks after the scrolling for you. When an item is selected, you could pop up a dialog with all the resource-heavy controls which the user can manipulate as required and then the resulting settings would be applied to the selected element.

M23

P.S. If you do decide to go that way then I will move this all into a separate thread as my UDF will no longer be involved.

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

Yes you can delete the replies. But I think you can leave one behind, letting others know if a huge amount of data is loaded once, it may make he GUI freeze with the scrollbar.

 

PS Can I ask you again for your help ? I found another solution for my problem, and it might not be 100% related to this topic, But I'm suck in loading different range of names into different tabs when clicked. or you suggest I open a new topic, maybe it might help someone else.

Edited by Siwa
Link to comment
Share on other sites

  • 4 weeks later...

Haven't read comments if this was mentioned before (or if I'm doing something wrong), but a possible bug I've found is that, for example, when the scroll position locator is low (in the image it's at the bottom), you then click the taskbar icon to hide all windows (Show desktop), and then you activate the window with your scrollbar again and you scroll up, all that content is gone...

Update: Just noticed a similar problem so I could study that first ...

 

scrollbar 1.jpg

scroll bar 2.jpg

Edited by Guy_
added Update
Link to comment
Share on other sites

  • Moderators

Guy_,

And did studying that thread help solve your problem?

If not, then please post the code you are using and I will take a look.

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

16 hours ago, Melba23 said:

And did studying that thread help solve your problem?

Yes, I've got it properly solved.

Essentially, it seems I just needed to insert and change this bunch of lines a bit ...

Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE
...

Have a great weekend! :)

Edited by Guy_
Link to comment
Share on other sites

  • 6 months later...

Hello Autoit Team,

I'm doing something wrong or when I use the function

$aCoord = _GUIScrollbars_Locate_Ctrl($frm_Test,10,450)

 with only the horizontal scrollbar activated in the form it returns

@error with value 2 :               2 - Parameter error.

In my window I prefer not to have vertical scrollbar.

Thank you for the support.

:rolleyes:

Link to comment
Share on other sites

  • Moderators

Efo74,

I will try and see what I can do with the information you have given me, but please post a runnable script which shows the error.

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

Sorry, I'll give you a brief example of the problem ... in this case error returns 0.

Only with horizontal scoll. if there is vertical scollbar, all is ok.

#include-once

#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GUIScrollbars_Ex.au3>
#include <array.au3>

HotKeySet("{F10}","ChangeButtonPosition")

Global $frm_Test,$btn_firstbutton

frm_Test()

;*****************************************************************************************************************************************************************************
Func frm_Test()
;*****************************************************************************************************************************************************************************
$frm_Test = GUICreate("Test",600,500)

GUISetBkColor($COLOR_BLACK)

$btn_firstbutton = GUICtrlCreateButton("TEST",10,10,100,40)

_GUIScrollbars_Generate($frm_Test,600+200,490,0,0,False)
GUISetState(@SW_SHOW)
While True
$nMsg = GUIGetMsg()


if $nMsg=$GUI_EVENT_CLOSE Then ExitLoop

Wend

GUIDelete($frm_Test)
Return 0
EndFunc

;*****************************************************************************************************************************************************************************
Func ChangeButtonPosition()
;*****************************************************************************************************************************************************************************
$aCoord = _GUIScrollbars_Locate_Ctrl($frm_Test,10,10)
if Not IsArray($aCoord) Then
MsgBox(0,"Error",@error)
Else
MsgBox(0,$aCoord[0],$aCoord[1])
GUICtrlDelete($btn_firstbutton)
$btn_firstbutton = GUICtrlCreateButton("TEST",$aCoord[0],$aCoord[1],100,40)
EndIf
EndFunc

 

:rolleyes:

Link to comment
Share on other sites

  • Moderators

Efo74,

Thank you for that report. i believe I have fixed the problem - could you please try this Beta code and see if it works for you: GUIScrollBars_Ex_Test.au3

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

  • Moderators

Efo74,

Delighted I could solve it so quickly!

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

  • Moderators

[BugFix Version] - 2 May 21

Fixed: Getting existing control positions no longer errors if a scrollbar is not activated.

New UDFs, examples in first post.

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

  • Moderators

Efo74,

So glad you find my UDFs useful - thanks for taking the time to say so.

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

  • 1 month later...
#include <GUIScrollBars_Ex.au3>

$iLeft = 5
$iTop = 40
$iWidth = 100
$iHeight = 25
$iSpacing = 30

$hGUI = GUICreate('scroll window', 600, 500, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX))
GUISetBkColor(0x000000,$hGUI)
$hGUI2 = GUICreate("", 488, 464, $iLeft, 26, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
For $i = 1 To 50
    GUICtrlCreateLabel('Label ' & $i, $iLeft, $iTop, $iWidth, $iHeight)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetResizing(-1, $GUI_DOCKALL)
    $bot = $iTop + $iHeight
    $iTop = $bot + $iSpacing
Next

$cButton = GUICtrlCreateButton("Maximize", 400, 40, 50, 30)

$iMaxScrollHeight = $iTop

_GUIScrollbars_Generate($hGUI2, 0, $iMaxScrollHeight)

GUISetState(@SW_SHOW, $hGUI)
GUISetState(@SW_SHOW, $hGUI2)

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            GUISetState(@SW_MAXIMIZE)
    EndSwitch
Wend

Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
        #forceref $iMsg, $wParam, $lParam
        If $hWnd = $hGUI Then
            Local $aGUI_Size = WinGetClientSize($hGUI)
            WinMove($hGUI2, "", Default, Default, ($aGUI_Size[0] - 14), ($aGUI_Size[1] - 34))
            If $aGUI_Size[1] < $iMaxScrollHeight Then
                _GUIScrollbars_Generate($hGUI2, 0, $iMaxScrollHeight)
            EndIf
        EndIf
EndFunc   ;==>_WM_SIZE

As shown in the above code, after the parent GUI sets the background, it finds that the blank above and below the vertical scroll bar is relatively wide.

Just a little question, which can be ignored.

:)

20210610125036.png

Edited by Letraindusoir
Link to comment
Share on other sites

  • Moderators

Letraindusoir,

If you tell AutoIt which GUI you want to maximize, the scrollbars size correctly:

Case $cButton
            GUISetState(@SW_MAXIMIZE, $hGUI)

Otherwise it is the child who gets maximized and the scroll resizing calculations based on the size of the main GUI give the wrong answer - as shown by the results you got.

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

  • 5 months later...

Hello everyone,
I have a problem with the sample source code:

#include <GuiConstantsEx.au3>
#include <GUIScrollbars_Ex.au3>

; Create GUI with red background
$hGUI = GUICreate("Test", 500, 500)
GUISetBkColor(0xFF0000, $hGUI)

; Create a 1000x1000 green label
GUICtrlCreateLabel("", 0, 0, 1000, 1000)
GUICtrlSetBkColor(-1, 0x00FF00)

GUISetState()

; Generate scrollbars - Yes, this is all you need to do!!!!!!!!!!!!!!!!!!!!
_GUIScrollbars_Generate($hGUI, 1000, 1000)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_RESTORE,$GUI_EVENT_MAXIMIZE
            _GUIScrollbars_Restore($hGUI,True,True)

        Case $GUI_EVENT_MINIMIZE
            _GUIScrollbars_Minimize($hGUI)
    EndSwitch
WEnd

1) I run the script
2) I position the scrollbars at the maximum of x and at the maximum of y (in this way I see the red stripes)
3) Minimizing and maximizing the form all OK
4) However, if I press the "Show desktop" WIN + D key for example and then return to the form, I find myself the same condition as if I did not manage the Minimize and Maximize, that is, I find the scrollbars moved correctly, but the controls inside of the form are moved non correctly.
5) Is there a way to handle the "event" of the "Desktop show" so I can Make a _GUIScrollbars_Restore($hGUI,True,True) ?

Thank you for the support.

:rolleyes:

Link to comment
Share on other sites

  • Moderators

Efo74,

Quote

Is there a way to handle the "event" of the "Desktop show"[...] ?

No idea - but I will start looking!

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

Thanks Melba23 for your help, these are the problems that make me angry, because I can't understand how to solve them. The problem is not very serious, as by minimizing or maximizing the window the form returns to its place correctly. I thought I could handle events for the form when it is active or inactive, I'm running tests ... :ILA2:

:rolleyes:

Link to comment
Share on other sites

  • Melba23 changed the title to Scrollbars Made Easy - New version 27 Jan 22

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