Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: blueshake on August 21, 2009, 01:29:10 pm

Title: wxauinotebook
Post by: blueshake on August 21, 2009, 01:29:10 pm
hi,I try to  implement such a function that when i double click the tab on the notebook,the tab  closed.so i need to hook the double click message on wxauinotebook ,but i just found  EVT_AUINOTEBOOK_BG_DCLICK
message .
so anyone has any comment on this?
Title: Re: wxauinotebook
Post by: Jenna on August 21, 2009, 01:45:18 pm
hi,I try to  implement such a function that when i double click the tab on the notebook,the tab  closed.so i need to hook the double click message on wxauinotebook ,but i just found  EVT_AUINOTEBOOK_BG_DCLICK
message .
so anyone has any comment on this?

If you look into the wxWidgets sources (stable and trunk) you see that it's just not implemented.And what's more it can not easily be changed, because the event is thrown by wxAuiTabCtrl's OnLeftDClick-event.

It's no problem to inherit a class from wxAuiNotebook, but to make it work you also need to derive a class from wxAuiTabCtrl and overwrite wxAuiNotebooks functions where the tabctrl get's created, but some of these functions also use wxTabFrame, but wxTabFrame is only declared in auibook.cpp, and therefore you can not use it in derived classes.

You can have a look into the wxWidgets bug-tracker, whether a bug-report exists about that issue, and if not you can post one.
Title: Re: wxauinotebook
Post by: blueshake on August 21, 2009, 02:10:33 pm
thanks,jens.
so it seems impossible to implement this function in codeblock.what a pity. :(
Title: Re: wxauinotebook
Post by: TDragon on August 21, 2009, 05:59:19 pm
Actually, you could just push a new wxEvtHandler on the tab control window object that intercepts the event first. See wxWindow::PushEventHandler.
Title: Re: wxauinotebook
Post by: Jenna on August 21, 2009, 06:13:30 pm
Actually, you could just push a new wxEvtHandler on the tab control window object that intercepts the event first. See wxWindow::PushEventHandler.

Thanks TDragon, didn't know this.
This might (hopefully) help a lot.
Title: Re: wxauinotebook
Post by: blueshake on August 25, 2009, 11:30:07 am
hi,jens
would you have any plan to do this (what TDragon said) to make the tab on wxauinotebook could be closed
by double click?
Title: Re: wxauinotebook
Post by: mariocup on August 25, 2009, 12:47:24 pm
Hi blueshake,

the editor tabs can be closed also with a Ctrl+W shortcut and this works in my eyes much faster then a double-click on a tab. If we get access to the double click event, we should think also about other features.

Although I am not a friend of eclipse there you have the possibilty to double-click on a editor tab and then all message panels, project explorer etc. are minimized and the selected editor appears. With another double click the message panel etc. appear again. Sometimes this can be very helpful if you have a lot of docked windows and want to concentrate on a single file.
Title: Re: wxauinotebook
Post by: blueshake on August 25, 2009, 02:08:36 pm
hi,mariocup
the functionlity you mentioned above seems very interesting.
but the problem is I have no chance to access wxauinotebook
double click message,and as what jens said,there is no double
click message in wxauinotebook.so the method is to do what
TDragon mentioned.but this is out of my ability.
so do you have any idea on what TDragon said?
Title: Re: wxauinotebook
Post by: Jenna on August 25, 2009, 02:20:28 pm
I started looking into it, but sometimes my boss wants me to work for money.
Maybe this evening, but I'm not sure if it is possible at all, because it's not easy to get the wxTabCtrl's.