From: neilk on

Hi,

wxVERSION:2.8.4

I am capturing a select event from a listctrl.

I would then like to change the users selection in some circumstances.

Veto and Skip (false) do not work as this is a SELECTED event,so the
listctrl has already been changed.
So, i set up a new event and set the selection from the event handling
function.

I would expect OnStepListBox to be called once for the original user click
and once for the 'pendingevent' ,
however, the OnStepListBox function is called as exected above but then
another call similar to the user click event followed by another pending
event.

So, I would like to know where this other event is coming from and can i fix
it?
Or is there another way to achieve what i am trying to do?

thanks

EVT_LIST_ITEM_SELECTED(Wizard::ID_LB_STEPS, Wizard::OnStepListBox)

void Wizard::OnStepListBox (wxListEvent &e)
{
if (change selection back)
{
//set step list back to its original selection
wxCommandEvent ev;

ev.SetId(ID_LB_STEPS);
ev.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
ev.SetInt(currentPage_);

e.Skip(false);
e.StopPropagation();

AddPendingEvent(ev);

return;
}
e.Skip();
}

void Wizard::OnSelectStepListBox(wxCommandEvent &e)
{
lbSteps->SetItemState(e.GetInt(),
wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);

e.Skip();
}

--
View this message in context: http://www.nabble.com/wxListCtrl-Select-problem.-tp16851009p16851009.html
Sent from the wxWidgets - Users mailing list archive at Nabble.com.

From: Vadim Zeitlin on
On Thu, 24 Apr 2008 08:51:42 -0700 (PDT) neilk <neilk1976(a)hotmail.com> wrote:

n> I would then like to change the users selection in some circumstances.
n>
n> Veto and Skip (false) do not work as this is a SELECTED event,so the
n> listctrl has already been changed.

Are you aware about SELECTING version? This is the one you should use if
you don't want to allow the user action to happen.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/