Jump to content

ListView - scroll-bars


 Share

Recommended Posts

thru sub-classing maybe, from what I've seen it's not pretty.

Might ask Holger.

I take your word for it!... you know ListViews alot better than most

Maybe Holger has an extra bag of magic tricks..

But if its gonna be ugly... i will have to find another direction

thanks Gary

8)

NEWHeader1.png

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
  • 2 weeks later...

Seems like the great minds have already been at this one so I will provide my hack. It clips a guictrl. There was a repaint problem which I have never been able to solve. So if you minimize and restore you would have to remake the control.

<Edit> hmmm. no repaint problem for this solution as far as I can tell.

#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, 260, 160)
$hListView = GUICtrlGetHandle($ListView)

$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
Edited by picea892
Link to comment
Share on other sites

This works pretty well for GUIs but have no effect on ListViews...!?

Yes it does. Think about it, controls are windows, so why shouldn't it?

#include <ScrollBarConstants.au3>
#Include <GuiScrollBars.au3>
#include <ListViewConstants.au3>

GUICreate(@ScriptName, 640, 480, -1, -1)
$listview = GUICtrlCreateListView("col1  |col2|col3|col4|col5  ", 10, 10, 200, 150, $LVS_NOCOLUMNHEADER);,$LVS_SORTDESCENDING)
$item1 = GUICtrlCreateListViewItem("item2|col22|col23|col24|col25", $listview)
$item2 = GUICtrlCreateListViewItem("item1|col12|col13|col14|col15", $listview)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33|col34|col35", $listview)

GUISetState()

$hListView = GUICtrlGetHandle($listview)
_GUIScrollBars_ShowScrollBar($hListView, $SB_BOTH, False) ;remove comment and scrollbars disappear

Do
    Sleep(10)
Until GUIGetMsg() = -3
Link to comment
Share on other sites

Hmm... Temporary the scroll bars disappear... But when selecting Items via mouse,

the scroll bars reappear... Strange.

You can put _GUIScrollBars_ShowScrollBar() somewhere between the Do/Until-Loop,

but this isn't a real solution...

For the moment, the "hack" from picea892 (see above) works pretty well as long

as sticking two ListViews together...

Edited by supersonic
Link to comment
Share on other sites

Hmm... Temporary the scroll bars disappear... But when selecting Items via mouse,

the scroll bars reappear... Strange.

You can put _GUIScrollBars_ShowScrollBar() somewhere between the Do/Until-Loop,

but this isn't a real solution...

Yeah I just noticed that... Better try picea892's way.
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...