Possible bug in Choicebook

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
rex666
Earned a small fee
Earned a small fee
Posts: 20
Joined: Mon Nov 08, 2004 12:15 am

Possible bug in Choicebook

Post by rex666 » Fri Mar 04, 2005 8:06 am

I am using Choicebook in my app, but the way I'm using it involves a single actual wxChoicebook object that I use DeleteAllPages() and then AddPage() to add the new pages depending on a selection in a list.

What I found is that when you call DeleteAllPages(), the m_selection member doesn't get reset. This means that after I have added my new pages, and I go to set the current page using SetSelection() I get an assert about an invalid page (and the resulting horrible behavior if I ignore it).

I added a line in wxChoicebook::DeleteAllPages() that will reset the selection also (choicbkg.cpp:402):

m_selection = wxNOT_FOUND;

This works great for me, and seems to have no side effects. Does anyone have a better idea? Would this make sense to get included into the source tree?

Thanks
-robin

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Re: Possible bug in Choicebook

Post by ABX » Fri Mar 04, 2005 10:43 am

rex666 wrote:I am using Choicebook in my app, but the way I'm using it involves a single actual wxChoicebook object that I use DeleteAllPages() and then AddPage() to add the new pages depending on a selection in a list.
Great to know my addition is actually in use. I introduced it mainly as replacement of wxNotebook on small screens of smartphones :-)
rex666 wrote:I get an assert about an invalid page
Could you please do a minimal addition to minimal sample which duplicates the problem and add it to bug tracker and assign to me (abxabx) ?

Thanks in advance, ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2

Post Reply