Page 1 of 1

wxListCtrl, setting state

Posted: Thu Apr 12, 2007 12:55 pm
by Lloyd
Hi,
I am using a virtual list control. I want to set its state as selected (for the first raw) when the list control is created, how can I do this?
I tried SetState(), but it causes the program to crash...

My requirement is to simply make a default selection when the user is selected none..

Thanks and Regards,
Lloyd

Posted: Thu Apr 12, 2007 2:20 pm
by ddv
SetState ? You mean SetItemState I guess.

Code: Select all

SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
[/code]

Posted: Thu Apr 12, 2007 2:39 pm
by Lloyd
sorry,I mean the same

SetItemState()

But it causes my application to crash.

The style of list control is wxLC_REPORT|wxLC_SINGLE_SEL

Can you say me how to do this?

Thanks and Regards,
Lloyd

Posted: Thu Apr 12, 2007 4:30 pm
by ddv
You should post the code you use and identify your wxwidgets version and your platform.

I have tested on a virtual list with the same flags and all works.