Sign in to follow this  
Followers 0
winux38

Standalone scroll bar

4 posts in this topic

Hello,

I am looking for a solution allowing me to use windows scroll bar in a standalone mode anywhere in my window to control other widgets.

Control bar have to be horizontal or vertical.

thanks for your help

winux38

Share this post


Link to post
Share on other sites



How about something like this

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$iLastPos = IniRead("Test.ini", "Scroll", "VPos", 0)

$GUI = GUICreate("Test Script", 600, 200)

$ListView = GUICtrlCreateListView("Col          ", 20, 20, 40, 160)
$hListView = GUICtrlGetHandle($ListView)
_ControlToRoundedRectangle($ListView,21,0,40, 160,0)
$ListView2 = GUICtrlCreateListView("Col          ", 280, 20, 260, 160)
_ControlToRoundedRectangle($ListView2,0,0,240, 160,0)
$hListView2 = GUICtrlGetHandle($ListView2)

For $i = 1 To 80
    GUICtrlCreateListViewItem("Item " & $i, $ListView)
    GUICtrlCreateListViewItem("Next " & $i, $ListView2)
Next

GUISetState(@SW_SHOW, $GUI)

While 1
    Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    if _GUICtrlListView_GetTopIndex($hListView)<_GUICtrlListView_GetTopIndex($hListView2) then 
            _GUICtrlListView_Scroll($hListView2, 0, -12)
    elseif _GUICtrlListView_GetTopIndex($hListView)>_GUICtrlListView_GetTopIndex($hListView2) then 
            _GUICtrlListView_Scroll($hListView2, 0, +12)
    EndIf
    
WEnd

Func _ControlToRoundedRectangle($aControl,$X1,$Y1,$X2,$Y2,$X3)
    Local $l
    Local $handle = GUICtrlGetHandle($aControl)
    $l = DllCall("gdi32.dll","int","CreateRoundRectRgn","int",$X1,"int",$Y1,"int",$X2,"int",$Y2,"int",$X3,"int",$X3)
    DllCall("user32.dll","int","SetWindowRgn","hwnd",$handle,"int",$l[0],"int",True)
EndFunc

Share this post


Link to post
Share on other sites

winux38.

Take a look at this thread where I developed a stand-alone scrollbar for another member. I hope it might work for you too. :mellow:

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 a lot to both of you. I have not time to test it now but will come back to you as sonn as I'll have check your solution.

winux38

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