HOWTO GetText from column > 0 in wxListCtrl?
BlitzMax Forums/Brucey's Modules/HOWTO GetText from column > 0 in wxListCtrl?
| ||
Create My wxListCtrl, wxLC_REPORT:ListCtrl[q] = New TMyListCtrl.Create_MyListCtrl(po, b, _x, _y, _w, _h, wxLC_REPORT) Step thru all the wxListCtrl Items: Local n:Int = 1 Repeat Local _li:wxListItem = New wxListItem.Create() _li.setID(n) ListCtrl[q].getItem(_li) echo "id: " + _li.getID() + " :: [" + _li.getText() + "] == [" + ListCtrl[q].GetItemText(n) + "]" ' both are the same they get text at Column 0 echo "---->[" + ListCtrl[q].OnGetItemText(n, 1) + "] :: id/n: " + _li.getID() ' I can't get ListCtrl[q].OnGetItemText to work (this need wxLC_VIRTUAL)! n = ListCtrl[q].GetNextItem(n) Until n = -1 I can't use wxLC_VIRTUAL when I use: _column = ListCtrl[q].insertItem(wxListItem) How can I catch the text for column > 0? |
| ||
Hi MOBii, here is a method that I use to get item from listctrl Method GetListviewItem:String(index:Int, col:Int) If GetWindowStyle() & wxLC_REPORT Then Local info:wxListItem = New wxListItem.Create() info.SetId(index) info.SetColumn(col) info.SetMask(wxLIST_MASK_TEXT) If GetItem(info) Then Return info.GetText() Else Return "" End If End If EndMethod -Henri |
| ||
Thank thee Henriinfo.SetColumn(col) info.SetMask(wxLIST_MASK_TEXT) GetItem(info)info.SetMask(wxLIST_MASK_TEXT) The point of SetMask is to speed up the reading (only get the text data)? |
| ||
It's there just to make sure that text data is retrieved, which it might not be by default. There maybe some speed gains for just getting that particular info, but they are almost negligible in real world. -Henri |