Author Topic: Close button for tabs  (Read 36384 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Close button for tabs
« on: August 01, 2005, 07:28:32 am »
I commited the patch for a button to close the tabs. But after considering it, I don't know if this should be good.

Should I move it into the toolbar (next to "open" and "save" icons) ?

Please share your opinions guys.

[attachment deleted by admin]

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Close button for tabs
« Reply #1 on: August 01, 2005, 07:33:42 am »
It's nice to see you're already working on it but I consider it's better to put it in the toolbar in the meanwhile.

darklordsatan

  • Guest
Re: Close button for tabs
« Reply #2 on: August 01, 2005, 07:48:47 am »
That is really nice rick. I like it where it is, good job.
BTW, *yuk* are you using win98 or the "classic windows" theme in XP?  :D

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Close button for tabs
« Reply #3 on: August 01, 2005, 08:00:59 am »
I'm still looking at it and I cannot really agree, it looks so lonely.

Maybe, just maybe, if it was a vertical toolbar with more things like: Close, Close all, Close all except this, Find, Find next, Find previous, ...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Close button for tabs
« Reply #4 on: August 01, 2005, 08:01:20 am »
the "classic windows" theme

So my question is... doesn't that empty wasted space look ugly?

darklordsatan

  • Guest
Re: Close button for tabs
« Reply #5 on: August 01, 2005, 08:34:24 am »
I dont see it ugly, but its a matter of personal taste, maybe if you could  put it on top of the slidebar (well, probably thats impossible?), but actually its looks perfect, reminds me of firefox.

zieQ

  • Guest
Re: Close button for tabs
« Reply #6 on: August 01, 2005, 08:37:57 am »
Personally, I find it ugly too! As Ceniza said, either you could add a bunch of other buttons, or maybe add this button in right of the dock bar (docked button?)

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Close button for tabs
« Reply #7 on: August 01, 2005, 10:40:52 am »
I think you should either
  • put some more buttons there as mentioned above.
  • put it to the right of the tabs, thus making the tab bar shorter than the width of the editor, as Firefox does. (Is this possible?)
Only as a last resort should you put it in the toolbar, IMHO. I don't think it really belongs there.

Anyway, I'm off to update my checkout and compile this new goodie 8).

[opens Code::Blocks, compiles, realizes this isn't in VERSION_1_0]
Bah :cry:
Any chance this will make it into version 1? This really is a must-have feature, I think. Imagine new users not being able to close a tab efficiently, and that turning them away. Not good.

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Close button for tabs
« Reply #8 on: August 01, 2005, 12:24:39 pm »
Why not use middle-click like in firefox to close a tab? Nice and quick.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Close button for tabs
« Reply #9 on: August 01, 2005, 12:28:39 pm »
Why not use middle-click like in firefox to close a tab? Nice and quick.
i second that suggestion: middle-click is the very best !

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Close button for tabs
« Reply #10 on: August 01, 2005, 12:43:40 pm »
Anyway, I'm off to update my checkout and compile this new goodie 8).

[opens Code::Blocks, compiles, realizes this isn't in VERSION_1_0]
Bah :cry:
Any chance this will make it into version 1? This really is a must-have feature, I think. Imagine new users not being able to close a tab efficiently, and that turning them away. Not good.
Actually it's only in VERSION_1_0. Keep in mind that anonymous CVS lags a few hours, so you might get the update if you try a little later ;)

Btw, I added a configuration option for this, as I don't really like it, which is disabled by default. To enable it, go to environment settings.

Yiannis.
Be patient!
This bug will be fixed soon...

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Close button for tabs
« Reply #11 on: August 01, 2005, 01:12:55 pm »
Why not use middle-click like in firefox to close a tab? Nice and quick.
Even better! However, I see no reason this can't be combined with any of the others, so why not do this in addition to an actual button? 8)

zieQ

  • Guest
Re: Close button for tabs
« Reply #12 on: August 01, 2005, 01:20:11 pm »
I think some folks have already said that middle-click or right-click to tabs are not easy to implement with wxWidgets. Bad news...

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Close button for tabs
« Reply #13 on: August 01, 2005, 01:47:21 pm »
Actually it's only in VERSION_1_0. Keep in mind that anonymous CVS lags a few hours, so you might get the update if you try a little later ;)

Btw, I added a configuration option for this, as I don't really like it, which is disabled by default. To enable it, go to environment settings.
After another CVS update (aside: sourceforge cvs is rather slow at the moment. I hate it when it does that) and 12 minutes of compiling I have sdk\resources\images\closebutton.png but no actual button or configuration option for one. Did that file get checked in earlier than the stuff to actually use it by any chance?

I think some folks have already said that middle-click or right-click to tabs are not easy to implement with wxWidgets. Bad news...

Too bad. Well, let's look at the bright side: at least it's not impossible, right? :wink:

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Close button for tabs
« Reply #14 on: August 01, 2005, 02:29:07 pm »
Actually it's only in VERSION_1_0. Keep in mind that anonymous CVS lags a few hours, so you might get the update if you try a little later ;)

Btw, I added a configuration option for this, as I don't really like it, which is disabled by default. To enable it, go to environment settings.
After another CVS update (aside: sourceforge cvs is rather slow at the moment. I hate it when it does that) and 12 minutes of compiling I have sdk\resources\images\closebutton.png but no actual button or configuration option for one. Did that file get checked in earlier than the stuff to actually use it by any chance?

i've just updated VERSION_1_0 from cvs and the closebutton is there and working,
but no checkbox in environment settings - it looks like that in anonymous cvs
actually is the version which was commited by rickg originally.



Offline Funto

  • Multiple posting newcomer
  • *
  • Posts: 81
Re: Close button for tabs
« Reply #15 on: August 01, 2005, 03:55:37 pm »
Personnaly I think it would be better to put this button at the same level as the tabs, as does Firefox, instead of in this empty vertical column whichs wastes size.
Middle-click is a good idea too.

As there are so many persons who like this feature, I think it's a bad idea to disable it by default mandrav, since as says Urxae, new users not being able to close a tab efficiently wouldn't keep using C::B.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Close button for tabs
« Reply #16 on: August 01, 2005, 05:23:04 pm »
i've just updated VERSION_1_0 from cvs and the closebutton is there and working,
but no checkbox in environment settings - it looks like that in anonymous cvs
actually is the version which was commited by rickg originally.

That's right. I added the configuration part a little later.
Also, whenever xrc files are changed, don't forget to run update.bat ;)

Yiannis.
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Close button for tabs
« Reply #17 on: August 01, 2005, 05:24:25 pm »
As there are so many persons who like this feature, I think it's a bad idea to disable it by default mandrav, since as says Urxae, new users not being able to close a tab efficiently wouldn't keep using C::B.

What's the problem Funto?
I don't like it, you don't like it, many people don't like it. It wastes space. Those that like it can just enable it once. Is it that hard?

Yiannis.
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Close button for tabs
« Reply #18 on: August 01, 2005, 05:33:57 pm »
Yes, adding the configuration was the next step. Anyway, I think I've realized how to make it more pretty. Instead of putting the button at the RIGHT of the tabs, I'll put it to the LEFT :D

And yes, it's quite easy to disable (I actually was going to do it today - thanks Yiannis)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Close button for tabs
« Reply #19 on: August 01, 2005, 05:56:06 pm »
Putting the close button in the tab row is a good idea, I think. Not only does it use space more efficiently, but it is also compatible with what the user would expect.
There may be an overdraw issue when there are a lot of tabs, but Firefox has that bug too, and it is quite possible to cope with, really.
 
The middle-click thing is a brilliant idea, but has the problem that it is not obvious, so it should be available in addition, but not the default way to close a tab.
I've been using Firefox (and Firebird) for so long that I don't remember what Internet Explorer looks like, but it never occurred to me to use the middle button on a tab. Maybe I'd have known had I ever read the documentation, but honestly, who reads docs anyway. :)
A UI should be obvious to every user running the program for the first time. A red "x" in the tab row is pretty obvious.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Close button for tabs
« Reply #20 on: August 01, 2005, 06:07:28 pm »
Putting the close button in the tab row is a good idea, I think. Not only does it use space more efficiently, but it is also compatible with what the user would expect.

The problem is, we DON'T know how to do it :(

But I have an Idea. Volunteers welcome.

* Take the wxNotebook sourcecode from wx2.6.x univ, and copy it to make our own wxNoteboox (the x is for "close" :lol: ) with the button in the tab row. I suppose it's easy, since in 2.6 notebook uses a special tab control. We only have (in theory) to add a sizer to the panel and put the button to the right of it. The tricky thing of course, is handling the version differences in 2.4 with 2.6, and getting rid of so many ifdef's to make it a compact and portable class. Since it's wxuniv we're talking about, I really hope (repeat: HOPE) there aren't many compatibility problems.

So if anyone wants to try, we'd really appreciate it. You don't have to add any event handling code to it, just draw the darn button. I'll take care of the rest.

zieQ

  • Guest
Re: Close button for tabs
« Reply #21 on: August 01, 2005, 06:19:43 pm »
I've heard about the HitTest for wxNotebook that could help detecting middle/right-click on the tabs, but this may be wxMSW- and wxUniv-specific. We must intercept click events on the widget.

For the close button on the tabs, my (simple) google search gave: not possible with native widgets but maybe subclassing the wxUniv's wxNotebook or wxBookCtrl ! So I advocate for the close button in the toolbar or at the right of the toolbar. After all why not: it does not waste space and could be placed near the place we expect it to be.

zieQ

  • Guest
Re: Close button for tabs
« Reply #22 on: August 01, 2005, 06:25:27 pm »

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Close button for tabs
« Reply #23 on: August 01, 2005, 06:36:56 pm »
So some people want to have it, and some not :? how to solve that problem ...
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Close button for tabs
« Reply #24 on: August 01, 2005, 06:54:54 pm »
Couldn't you just hack this by making the wxNotebook only as high as the tabs themselves, and then manually switching the editor that's displayed? That way, the wxNotebook width and the editor width are independant...
Not very 'neat' though. Just a thought.

So some people want to have it, and some not :? how to solve that problem ...

In the way Yiannis solved it: add a preference option. Of course, then the problem becomes "what should be the default value of that option" ;)

Offline Funto

  • Multiple posting newcomer
  • *
  • Posts: 81
Re: Close button for tabs
« Reply #25 on: August 01, 2005, 07:51:04 pm »
Mandrav, I never said I didn't like the possibility to put a close button, on the contrary I think it is necessary (or at least a "close" item in a popup menu when right clicking on the tab).
The problem is that it wastes space, so as says zieQ, the best solution would be to put this button at the right of the toolbar.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Close button for tabs
« Reply #26 on: August 01, 2005, 08:28:08 pm »
Which is the reason for me asking to use a derivative of wxNotebook (wx2.6 "universal" version)

OK this is what we'll do:

I'll put the button to the LEFT of the notebook (for now, until something better's done). Default option is _OFF_. I'll add a "did you know" hint to tell users about the feature.

_YOU_ will research on using the wxnotebook (2.6 univ) and do some tests.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Close button for tabs
« Reply #27 on: August 01, 2005, 08:31:33 pm »
Mandrav, I never said I didn't like the possibility to put a close button, on the contrary I think it is necessary (or at least a "close" item in a popup menu when right clicking on the tab).
The problem is that it wastes space, so as says zieQ, the best solution would be to put this button at the right of the toolbar.

Don't get me wrong. All I 'm saying is it is disabled by default because not all people like it. For those who do like it, it's simple as a click to enable it. That's all.

Putting the close button in the tab row is a good idea, I think. Not only does it use space more efficiently, but it is also compatible with what the user would expect.

The problem is, we DON'T know how to do it :(

To add it in the tabs row is easy (I 've done it). The problem is that it interferes with the left-right spinbox that appears when not all tabs fit in the row...

Yiannis.
Be patient!
This bug will be fixed soon...

Offline kagerato

  • Multiple posting newcomer
  • *
  • Posts: 56
    • kagerato.net
Re: Close button for tabs
« Reply #28 on: August 02, 2005, 02:53:13 am »
Quote from: mandrav
To add it in the tabs row is easy (I 've done it). The problem is that it interferes with the left-right spinbox that appears when not all tabs fit in the row...

Personally, it seems to be more consistent and less complicated for tab bars to deal with an excess of open windows/documents by shrinking the size of each individual tab.  The expansion to multiple lines is inelegant IMO, and it's clear that the overlapping placement of the spinbox and the close button interfere with one another.

The optimal solution is, of course, to improve the original widget which the tab bar derives from so that it supports any combination setting of tabs, spin box, and close button.  One can wonder how much work that would take.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Close button for tabs
« Reply #29 on: August 02, 2005, 05:07:07 am »
I posted a topic in "help wanted". We need to implement a wxNotebook-like class but with a closebutton :) For that we need to use the wxTabCtrl class. Those interested please reply in the other topic. Thanks.

DreadNot

  • Guest
Re: Close button for tabs
« Reply #30 on: August 09, 2005, 02:07:11 pm »
As far as the toolbar is concerned, add the following buttons after Save:
1] Save All
2] Close (current tab/file)
3] Close All

Did anyone notice that Mozilla also has a "New Tab" button on the left side as well as a "Close Tab" on the right.

The notebook code calls "wx/generic/tabg.h", so what I believe needs to be changed is "tabg.h" and "tabg.cpp" in wx to have a controlled left and right margin something like it has for the top margin.  I think these files are generic to all wx versions.  The left/right margin should act something like (and in addition to) the m_tabHorizontalOffset value.  These margins would allow the addition of the button(s) to the left and right sides of the notebook in the tabs area.

Offline AkiraDev

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Close button for tabs
« Reply #31 on: August 09, 2005, 05:48:44 pm »
Quote
Insert Quote
As far as the toolbar is concerned, add the following buttons after Save:
1] Save All
2] Close (current tab/file)
3] Close All

I would agree on just adding the Save All button, as during workflow, it is the option I use the most.

Quote
Did anyone notice that Mozilla also has a "New Tab" button on the left side as well as a "Close Tab" on the right.

Do you mean adding a "new empty text file" button?

Quote
The notebook code calls "wx/generic/tabg.h", so what I believe needs to be changed is "tabg.h" and "tabg.cpp" in wx to have a controlled left and right margin something like it has for the top margin.  I think these files are generic to all wx versions.  The left/right margin should act something like (and in addition to) the m_tabHorizontalOffset value.  These margins would allow the addition of the button(s) to the left and right sides of the notebook in the tabs area.

Very useful info, will look into that.

Regards

Offline AkiraDev

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Close button for tabs
« Reply #32 on: August 26, 2005, 10:28:05 am »
Hi to all.

Someone recently added a tabbed control which mimics the Microsoft Visual Studio .NET source code editor layout to the wxForum Code Dump.
Those interested can take a peek here: http://www.solidsteel.nl/users/wxwidgets/viewtopic.php?t=3781&sid=b3f75113346331c93f921302889bb031

Regards

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Close button for tabs
« Reply #33 on: August 26, 2005, 05:55:18 pm »
Alright, so that means we should merge the wxTabbedCtrl with (um... forgot your name sorry :oops: ) 's modified notebook code.

kimastergeorge

  • Guest
Re: Close button for tabs
« Reply #34 on: August 28, 2005, 10:14:56 pm »
No, all you really need is their version. It doesn't have any sort of customizable button, but it works the same as mine, and seems to be much prettier (and cleaner).

Offline AkiraDev

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Close button for tabs
« Reply #35 on: August 29, 2005, 02:18:06 am »
Personally, I would like to have an option of having the tabs in either FF-style or VS.NET-style.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Close button for tabs
« Reply #36 on: August 29, 2005, 05:34:22 am »
No, all you really need is their version. It doesn't have any sort of customizable button, but it works the same as mine, and seems to be much prettier (and cleaner).

Um...

"The only significant difference between this class and wxNotebook is that if you are adding new page you don't need any wxWindow instance for the page itself. It's because wxTabbedCtrl doesn't have any pages, only tabs."

This is what worries me. It's not a notebook, it's a tab control. I'm afraid it can't be just interchanged with our notebook...

Offline AkiraDev

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: Close button for tabs
« Reply #37 on: August 29, 2005, 10:16:29 am »
Taking a look to the source, one can adapt wxTabbedCtrl so that it will also own a std::vector of pointers to wxWindow. Then, the selection events are handled by using calls to wxWindow::Show(). I don't see such a big problem with the "absence" of wxWindows.

The only problem I could actually see was that there is no wxScrollBar showing up on the right side when the bar is overflown by tabs. Nasty. But, then again, this can also be worked around.
« Last Edit: August 29, 2005, 10:18:09 am by AkiraDev »

takeshimiya

  • Guest
Re: Close button for tabs
« Reply #38 on: August 29, 2005, 10:15:26 pm »
Note that Firefox doesn't show a ScrollBar when the bar is overflown by tabs.
The best I think is:

[SOMETAB] [SOMETAB] [SOMETAB] [<] [>] [CLOSE]

And would be better if the ScrollBar scrolls "pages of tabs" instead of "1 tab" each time you clic on a Prev/Next of the ScrollBar.
« Last Edit: August 30, 2005, 01:57:41 am by takeshimiya »

kimastergeorge

  • Guest
Re: Close button for tabs
« Reply #39 on: August 30, 2005, 12:24:13 am »
Note that Firefox doesn't show a ScrollBar when the bar is overflown by tabs.
The best I think is:

[SOMETAB] [SOMETAB] [SOMETAB] [<] [>]


And would be better if the ScrollBar scrolls "pages of tabs" instead of "1 tab" each time you clic on a Prev/Next of the ScrollBar.

You're gonna have to take that up with the dudes at GTK+ and the Windows GUI designers.

Honestly, though, I have no idea how Firefox does what it does! It almost shouldn't happen! Nowhere in the GTK+ or Windows API (not to mention wxWidgets) is there a method for doing that.