views:

22

answers:

1

Is there any way to change the page of a wxNotebook or wxChoicebook programmatically? Looking at the documentation I would have thought that wxChoicebook::ChangeSelection was the way to go, or wxChoicebook::SetSelection if I want the page changing/changed events to be sent. However, I don't know what these functions expect as input. The seem to require a size_t type input, but all I get from a GetSelection is an integer. I'm working in wxPython if that helps.

A: 

I think you should be using wxNotebook::ChangeSelection, and in that function the size_t parameter refers to the integer index of the notebook page you would like to switch to. ChangeSelection(0) would change to the first notebook page, ChangeSelection(1) to the second, and so on.

I did test this in code, and it works. I use wxWidgets with C++ though, I didn't test wxPython. Hope that helps!

Evan Cordell
It works in python as well, I just got confused about the size_t specification. I'm not sure why they didn't just say it accepted an integer. Thanks.
David Morton
size_t is often an unsigned integer, though not always. See the wiki article for (slightly) more info: http://en.wikipedia.org/wiki/Size_t
Evan Cordell