Kirix Support Forums

Clean semantic for tab selection

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

Clean semantic for tab selection

Postby Antoine on Mon Nov 20, 2006 7:29 pm

Hi,

here is a problem that shows bad "tab selection" semantic.

Create a left pane, with a multibook inside. Add 3 tabs (tab1, tab2, and tab3) with select=false. Make sure all 3 tabs show different data when displayed, so that you can check whose data is displayed quickly.

The tab highlighted as "selected" (bold face, which means its "active" attribute is true) is tab1 - the first one created. However, GetSelection() returns -1 instead of 0 which is tab1's index. Worse, the drawing under the tab caption (in the pane area) is the one of tab3! the last inserted...

If you move the pane sizer, you will see that tab1 is redisplayed and tab3 immediatly after (causing flickering). If you take another pane and drag it over the multibook, you will see the hint. When the hint moves elsewhere then only tab1 data is redrawn (under the hint), and this will result in garbage drawing : drawing from tab1 where the hint went, drawing from tab3 where it didn't.

Very surprisingly, if you use the default wxWidget notebook you will have the same problem.

Therefor, I would suggest a clean semantic for selection and activity:
- the selection is always the tab whose data is displayed
- if there is a tab in the notebook, then selection can not be -1
- thus, after the first page is inserted, this page becomes the selection (even if select = false)
- when other pages are inserted, the old selection is kept if select = false, and the new page becomes the selection if select = true
- regarding activity: there is at most only one active tab at a time, and if there is one it must be the selection. The activity attribute will only govern the visual aspect of the selection's caption.
- if a new tab is inserted with select=false, then the activity remains as it was for previous selection
- if a new tab is inserted with select=true, then it will become "activated" if and only if the previous selection was activated
- for the first tab created, select has not meaning (the tab will become the selection anyway), so we can use the value to decide if the tab is active or not
- another option is to have 2 bool args for tab insertion : select and active, instead of only one

Another problem with multibooks: when the frame manager manages the Pane activity (for instance highlight the caption of active pane), if there is a multibook, then the activity is not managed correclty when a page of the multibook gets focus.

Best regards,

Antoine
Antoine
Registered User
 
Posts: 7
Joined: Mon Nov 06, 2006 6:16 pm
Location: Paris - France

Postby disasm on Mon Nov 20, 2006 10:49 pm

I am seeing similar problems also. I am using wxAuiMDIParentFrame and dynamically creating some wxAuiMDIChildFrame's which show up as tabs. So the problem I am seeing is that I create some tabs and set focus to the first tab I created. I can then click on any other tab and that tab is now the active one. But, as soon as my application loses focus (for example, if I click on the start menu) then the first tab that I created gets activated, even though I did not click on it or programmatically select it. I see this problem sometimes when my app loses focus and sometimes when it gets focus again.

Any ideas??? :?:
disasm
Registered User
 
Posts: 16
Joined: Tue Jan 10, 2006 8:56 pm

Postby Ben on Tue Nov 21, 2006 2:49 am

Hi Antoine and disasm,

You both are right. I think I've fixed the problem in CVS head.

Here are the sematics I've decided upon: When you add the first page, even if select is false, it will become the active page. Though, if select is false, no selection events will be fired because of the page addition. However, GetSelection() will always return 0 after adding a page to an empty control.

I've checked this in. Can you two check this to make sure this is ok now? We have just a few more days before the release to make sure this is right.

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

Return to wxAUI Questions, Thoughts & Feedback