[wxPython] wxListCtrl - Getting the data?

I'm quite sure I don't understand how the wxListCtrl and the wxListItem (m_mask, m_stateMask, m_state) work together. I have read the help file and specifically the description of wxListCtrl::SetItem and am really lost now. I think my brains about to explode!

If anyone can explain wxListCtrl I would greatly appreciate your help.

Gene

···

------Original Message------
From: Gene Chiaramonte <gchiaramonte@mail.com>
To: wxpython-users <wxpython-users@wxwindows.org>
Sent: May 29, 2000 4:32:45 PM GMT
Subject: [wxPython] wxListCtrl - Getting the data?

From the wxPython demo, I have copied the following code for the wxListCtrl where the list items are insert/set for 3 columns.

for x in range(len(items)):
            key, data = items
            self.list.InsertImageStringItem(x, data[0], idx1)
            self.list.SetStringItem(x, 1, data[1])
            self.list.SetStringItem(x, 2, data[2])
            self.list.SetItemData(x, key)

Now I am do not know how to access the items by row/col in my code. I want to be able to loop through the list control and get each row/col value.

for x in range(len(self.list.GetItemCount())):
    # how do i get the value for each row x
    # and colum in the list control?

Thanks for any help,

Gene
______________________________________________
FREE Personalized Email at Mail.com
Sign up at Free email accounts with mail.com | Log in here or register today

_______________________________________________
wxPython-users mailing list wxPython-users@wxwindows.org
http://wxwindows.org/mailman/listinfo/wxpython-users
______________________________________________
FREE Personalized Email at Mail.com
Sign up at Free email accounts with mail.com | Log in here or register today

Gene Chiaramonte wrote:

I'm quite sure I don't understand how the wxListCtrl and the wxListItem (m_mask, m_stateMask, m_state) work together. I have read the help file and specifically the description of wxListCtrl::SetItem and am really lost now. I think my brains about to explode!

Quick practical guide:

To access item on row/col:
item = wxListCtrl.GetItem(itemIndex, column)

To check if an item is selected:
selected = wxListCtrl.GetItemState(itemIndex, 0) &
wxLIST_STATE_SELECTED:

If selected is not zero, the item was selected, similarly you may
check for the other flags.

What I'd like to know is how to find out the number of columns.

···

--
Riaan >>> a='a=%s;a%%`a`';a%`a`
___________________________________________________
Boa Constructor - RAD GUI building IDE for wxPython
     http://boa-constructor.sourceforge.net