wxListCtrl, setting state Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Lloyd
Super wx Problem Solver
Super wx Problem Solver
Posts: 350
Joined: Wed May 03, 2006 2:36 pm
Location: India
Contact:

wxListCtrl, setting state

Post by Lloyd » Thu Apr 12, 2007 12:55 pm

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

ddv
Knows some wx things
Knows some wx things
Posts: 25
Joined: Mon Dec 18, 2006 4:23 pm

Post by ddv » Thu Apr 12, 2007 2:20 pm

SetState ? You mean SetItemState I guess.

Code: Select all

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

Lloyd
Super wx Problem Solver
Super wx Problem Solver
Posts: 350
Joined: Wed May 03, 2006 2:36 pm
Location: India
Contact:

Post by Lloyd » Thu Apr 12, 2007 2:39 pm

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

ddv
Knows some wx things
Knows some wx things
Posts: 25
Joined: Mon Dec 18, 2006 4:23 pm

Post by ddv » Thu Apr 12, 2007 4:30 pm

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.

Post Reply