qwert

Can ListView's horizontal scroll bar be prevented?

4 posts in this topic

I have a special situation where I need a hidden sort field as part of each set of information in a ListView.  The actual sort is preformed by the script (_SortItems), so the user never needs to view—or even be aware of—the sort parameter.

Can a ListView be defined in a way that prevents the horizontal scroll bar from ever being displayed?

Here's a script that shows the situation:

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

Local $array[5][3] = [ ['C:\Program Files','12/01/2016','201'], _
                            ['D:\Au3 Scripts','07/03/2014','301'], _
                            ['F:\Downloads','01/01/2017','101'] ]

$GUI = GUICreate("ListView Test", 400, 320, -1, 180)

$Go = GUICtrlCreateButton("Go", 324, 84, 60, 28)
GUICtrlSetTip(-1, "Select a listview entry and click Go")

$Elements = GUICtrlCreateListView("", 24, 12, 280, 280)

_GUICtrlListView_AddColumn($Elements, "Directory Name", 200)
_GUICtrlListView_AddColumn($Elements, "Date", 76)
_GUICtrlListView_AddColumn($Elements, "Unseen sort", 76)

_GUICtrlListView_AddArray($Elements, $array)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    Case $Go
        $Line = _GUICtrlListView_GetItemTextString($Elements)
        msgbox(0, "Operation", $Line)
    EndSwitch
WEnd

Thanks in advance for any suggestions of what to try.

Share this post


Link to post
Share on other sites



qwert,

Just hide the "hidden" column by setting its width to 0:

_GUICtrlListView_AddColumn($Elements, "Unseen sort", 0)

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

Wow.  I had been looking at that for too long.  It works, of course.

Thanks for your timely response.  Much appreciated.

 

Effective Solution.png

 

Share this post


Link to post
Share on other sites

qwert,

Glad I could help.

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