Sign in to follow this  
Followers 0
pammi

Fetch ListControl Column Name and control type

6 posts in this topic

Hi Everyone,

Can I know how to fetch the column name and the control type of the listcontrol box.

The one which i am automating has the following columns

1)Message name(of checkbox type)

2)Data bytes

I want to fetch the column names(i.e. message name and Data bytes) and the control type of the message name(i.e. checkbox)

please share your ideas on this.

Thanks in advance

Share this post


Link to post
Share on other sites



I used GUICtrlRead ( controlID [, advanced] ) function, but that din't help.its returning 0 which is failure.

Below is the summary info :

>>>> Window <<<<

Title: ABC

Class: Afx:400000:8:10011:0:70733

Position: -4, -4

Size: 1032, 746

Style: 0x15CF8000

ExStyle: 0x00000110

Handle: 0x001C064C

>>>> Control <<<<

Class: Button

Instance: 11

ClassnameNN: Button11

Name:

Advanced (Class): [CLASS:Button; INSTANCE:11]

ID:

Text: Tx Message List

Position: 225, 152

Size: 561, 182

ControlClick Coords: 151, 43

Style: 0x50000007

ExStyle: 0x00000004

Handle: 0x000807FA

Share this post


Link to post
Share on other sites

First the control you're trying to read from isn't a list control, it's a listview control, there's a difference. Second, here's a script I put together to show how to get the text of the header of the listview you're trying to access.

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
_Main()

Func _Main()
    Local $aInfo, $hListView

    GUICreate("ListView Get Column", 400, 300)
    $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
    _GUICtrlListView_SetColumnWidth($hListView, 0, 100)
    GUISetState()

    GUICtrlCreateListViewItem("index 0|data1|more1", $hListView)
    GUICtrlCreateListViewItem("index 1|data2|more2", $hListView)
    GUICtrlCreateListViewItem("index 2|data3|more3", $hListView)
    GUICtrlCreateListViewItem("index 3|data4|more4", $hListView)
    GUICtrlCreateListViewItem("index 4|data5|more5", $hListView)
    Local $ColumnText = ""
    For $I = 0 To _GUICtrlListView_GetColumnCount($hListView) - 1
        $aInfo = _GUICtrlListView_GetColumn($hListView, $I)
        ConsoleWrite("Column header text for column #" & $I & " = " & $aInfo[5] & @CRLF)
        $ColumnText &= $aInfo[5] & "|"
    Next
    $ColumnText = StringTrimRight($ColumnText, 1)
    ConsoleWrite(@CRLF & "All column header text = " & $ColumnText & @CRLF)
    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()
EndFunc   ;==>_Main

It has been modified from the example script in _GUICtrlListView_GetColumn. There's more information about the columns in the listview that it can give you, but this demo shows how to get the header text.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I was able to fetch the column header names using _GUICtrlHeader_GetItemText. However I am not able to retrieve the column header type. In my example the first column is of checkbox type and I am not able to retrieve whether its enabled or not.

any help??

Share this post


Link to post
Share on other sites

I mean the column header type in the listview control...

Share this post


Link to post
Share on other sites

The header information can't tell you if there are checkboxes. The listview has the style you're looking for, you'd need to use _GUICtrlListView_GetExtendedListViewStyle to get the style to see if there are checkboxes enabled in it. See the example in the help file for how to do that.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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