Kirix Support Forums

Page reordering bug

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

Page reordering bug

Postby jfrench on Mon Jan 08, 2007 7:40 am

Hi,

I've found a bug in notebook page reordering. When you reorder a tab by dragging it it reorders it visually fine but it does not reorder it in the notebook's m_tabs member variable. This means that when I later read back the pages consecutively using GetPage() they are still in the old order. Not sure what the fix is yet but I'm looking at it.

Cheers,
James
jfrench
Registered User
 
Posts: 14
Joined: Mon Dec 18, 2006 6:58 am

Postby jfrench on Mon Jan 08, 2007 8:55 am

The fix was again very simple.

In wxAuiNotebook::OnTabDragMotion(wxCommandEvent& evt):

wxWindow* src_tab = dest_tabs->GetWindowFromIdx(src_idx);
m_tabs.MovePage(src_tab, dest_idx); <---- ADD THIS
dest_tabs->MovePage(src_tab, dest_idx);
dest_tabs->SetActivePage((size_t)dest_idx);
dest_tabs->DoShowHide();
dest_tabs->Refresh();

I will endeavour to get some patches together as I've got about 4 bug fixes to get into wx cvs now.

Cheers,
James
jfrench
Registered User
 
Posts: 14
Joined: Mon Dec 18, 2006 6:58 am

Postby Ben on Mon Jan 08, 2007 12:29 pm

Hi there,

As far as wxAuiNotebook::m_tabs, it was my intention to leave the order of array alone, and have the change in page position be solely visual.

I'm certainly not opposed to adding a function which can retrieve a page pointer by visual offset.

All the best,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Postby jfrench on Mon Jan 08, 2007 1:19 pm

Something is required so it is possible to persist the notebook pages in the correct order.

By the way, what is the reason for this design decision? I must say I'm not clear on why there are two tab containers either, but then again I haven't dug too deeply.

James
jfrench
Registered User
 
Posts: 14
Joined: Mon Dec 18, 2006 6:58 am

Postby Ben on Tue Jan 09, 2007 1:23 am

Hi James,

The reason is that, most of the time developers add their pages in a certain order to notebooks in a certain order. When the user is offered the possibility of arbitrarily reordering notebook tabs, this should not affect the actual order of the array of page pointers.

It's similar to a grid. When columns are reordered in a grid, this doesn't change the actual data representation of the table, merely the appearance on the screen.

The reason for the two tab containers is that the tab control allows split views. If you drag a tab to the bottom of the control in the sample, you will see this functionality. wxAuiNotebook was not developed to be just a generic tab control, but rather a way of presenting multiple documents on the screen at the same time, while maintaining the flexibility that a tab control offers.

Thanks much for your comments,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Postby gnschmidt on Wed Jan 10, 2007 10:16 am

Hi Ben

<I'm certainly not opposed to adding a function which can retrieve a page pointer by visual offset. >

That would be really helpful. On a related note, is it possible to query a tab as to where in the notebook it is docked (top, bottom, right, etc.)?

Many thanks,
Gerald
gnschmidt
Registered User
 
Posts: 20
Joined: Sat Sep 30, 2006 2:59 am

Postby Ben on Thu Jan 11, 2007 3:55 am

Hi Gerald,

No it isn't yet possible. I was trying to be as complete as possible when doing the API, but I guess I missed some stuff. I'll have to improve this when the next wx development cycle gets going.

Thanks,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Return to wxAUI Questions, Thoughts & Feedback