Jump to content

Recommended Posts

Posted (edited)

Hi,

There is "_GUICtrlListView_GetTopIndex" and "_GUICtrlListView_GetCounterPage" for height and number of items start/ visible;

I need the same for width and number of columns start/ visible.

Can it be done? Am I missing a function?

best, Randall

Edited by randallc
Posted

Hi,

There is "_GUICtrlListView_GetTopIndex" and "_GUICtrlListView_GetCounterPage" for height and number of items start/ visible;

I need the same for width and number of columns start/ visible.

Can it be done? Am I missing a function?

best, Randall

_GUICtrlListView_GetColumnWidth and _GUICtrlListView_GetItemRect

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Posted

_GUICtrlListView_GetColumnWidth and _GUICtrlListView_GetItemRect

Hi, thanks,

I'll look again; they looked more complicated than that, I thought to do with pixel counts; I'll check examples again.

(Does either give the number of the first visible column, or a way to calculate that?)

Best, Randall

  • 2 weeks later...
Posted

_GUICtrlListView_GetColumnWidth and _GUICtrlListView_GetItemRect

Hi,

best I can do is this;

Can you show me how to do it with

_GUICtrlListView_GetColumnWidth and _GUICtrlListView_GetItemRect

?

[As HitTest does other things to GUI, I think...]

; _GUICtrlListView_GetTopColumn
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
Global $hGui,$hListView
_Main()

Func _Main()
    Local $hListView
    
    $hGui=GUICreate("ListView Get Selected Column", 400, 300)
    $hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3", 2, 2, 394, 268)
    GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
    GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
    GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
    GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
    GUICtrlCreateListViewItem("line5|data5|more5", $hListView)
    GUISetState()


    ; Select item 50
    _GUICtrlListView_SetColumnWidth($hListView, 2, $LVSCW_AUTOSIZE_USEHEADER)
    _GUICtrlListView_SetItemSelected($hListView, 2)
    _GUICtrlListView_EnsureVisible($hListView, 2)
    MsgBox(4160, "Information", "Top Index: " & _GUICtrlListView_GetTopIndex($hListView))
    MsgBox(4160, "Information", "Top Column: " & _GUICtrlListView_GetTopColumn($hListView))
    MsgBox(4160, "Information", "Right Column: " & _GUICtrlListView_GetRightColumn($hListView))

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main
Func _GUICtrlListView_GetTopColumn($hListView)
    Local $aHitS = _GUICtrlListView_SubItemHitTest($hListView, 50, 100)
    return $aHitS[1]
EndFunc   ;==>_GUICtrlListView_GetTopColumn
Func _GUICtrlListView_GetRightColumn($hListView)
    Local $aiGUISize = WinGetClientSize($hGUI)
    Local $aHitE = _GUICtrlListView_SubItemHitTest($hListView, $aiGUISize[0] - 50, 50)
    Return $aHitE[1]
EndFunc   ;==>_GUICtrlListView_GetRightColumn
Best, randall

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...