-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add / New Tab button #4
Comments
You're right, it has no such option at present. I know I've thought about this in the past, but I can't remember whether I didn't do it because I thought it would be too tricky (and no-one was asking for it), or because I just didn't need it myself and didn't have the time. But now you'd presumably like such a feature, I should perhaps reconsider... [A few minutes later] Hmmm. Definitely not easy. The big difficulty with this sort of thing is that you can't actually host any controls on a TabControl (or on a TabControlExtra, which inherits from TABControl). So for example it's not possible to just add a button to it and move the button around depending on the accumulated width of the current tabs (like Edge, Chrome and Firefox do). Another possibility would be to have a 'special' tab (with a + icon), which is always kept last and which when clicked would create a new tab. It would have to be rendered specially so that it didn't disappear off to the right if enough tabs are added, and so on. Probably the best solution would be to re-engineer the TabControlExtra so that it inherits from UserControl rather than TabControl. The underlying TabControl would then just be hosted in the UserControl, and it would then be possible to add extra controls for this sort of purpose (and indeed would improve the implementation of the ControlPanel currently under development in Issue #3). But this would be a big job, and I don't want to go there except as a last resort. I'll spend a bit more time thinking about this and see what I can come up with. If you have any suggestions as to alternatives I haven't mentioned so far, feel free. |
Hi Richard Thank you for your prompt reply A "special" tab at the end which just contains a + icon and is narrower perhaps than other tab headings would work fine with me, and would seem to be the way a lot of paid for 3rd party controls do it (either that or a + at the end of the row, but as you say not so easy to achieve) Appreciate you looking, and any testing I can do for you please let me know Regards |
I've just had a thought. The 'add tab' thingy doesn't need to be an actual control of any sort, it just needs to be an image that I render in the right place and know the location of, so that a mouse click in that location can be handled by adding a new tab. That should be relatively easy to do. So the fact that I can't add controls to the underlying TabControl would then be irrelevant. I wonder whether the paid for controls are actually written from the ground up, rather than trying to wrestle the TabControl into behaving nicely? I suspect they probably are, and that's why they don't have the ugly tab scrolling thing, which I haven't yet found a way to get rid of (and which could throw a spanner in the works here, since it would be right where I'd want the 'new tab' image, and I can't paint over it). |
I suspect they are written from ground up, as the existing TabControl is so limited compared to what companies like DevExpress offer, especially for WinForms. Not sure why MS have never added bits such as add and close buttons to it as default as everyone uses/needs them |
They have to leave some room for others to make their living. |
Hi
Firstly great project, works really well
Unless I am missing it, I can't see that it has an option to show a button to be able to add / open a new tab e.g. like a + icon or similar?
Thank you
The text was updated successfully, but these errors were encountered: