wxListCtrl: how to chose an item?

Troels tk at tk.tk
Fri Nov 3 06:19:08 PST 2006


You can use wxListView instead of wxListCtrl, it has a Select() method.

Or you can add this to your own wxListCtrl-derivative:

     void SetSelection(long n, bool on = true)
     {
         SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, 
wxLIST_STATE_SELECTED);
     }
(same as wxListView::Select)

/Troels

Fibre Optic wrote:
> Hello,
> 
> I am looking for way I can call method of wxListCtrl object and set one 
> item i.e. in terms of object of wxNotebook it could look as follows:
> notebook->SetSelection(5)
> 
> Unfortunately, I am not able to find out relevant method for wxListCtrl. 
> Could some on of you put some light on the problem?
> 
> Regards,
> Fibre Optic






More information about the wx-users mailing list