Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TabCtrl » Deleting Tabs
Deleting Tabs [message #6829] Thu, 30 November 2006 20:40 Go to next message
dmcgeoch is currently offline  dmcgeoch
Messages: 52
Registered: November 2006
Location: New Jersey
Member
Just wondering if it is possible to delete tabs on the fly to dynamicly grow and shrink the number of tabs as needed. I looked at the built in functions for TabCtrl and did not see anything obvious.

Thanks,

Dave
Re: Deleting Tabs [message #6832 is a reply to message #6829] Thu, 30 November 2006 21:02 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
Hi Dave,

as far as i know that is not possible - you have to delete all of them ( myTabs.Reset() )and add them again without the one you want to delete.

Bas
Re: Deleting Tabs [message #6834 is a reply to message #6832] Thu, 30 November 2006 21:13 Go to previous messageGo to next message
dmcgeoch is currently offline  dmcgeoch
Messages: 52
Registered: November 2006
Location: New Jersey
Member
Thanks Bas,

That will work.

Dave
Re: Deleting Tabs [message #11040 is a reply to message #6829] Thu, 16 August 2007 09:41 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

It`s very uncomfortable.
Luzr, could you please add functionality for individual tabs removal?
Re: Deleting Tabs [message #11045 is a reply to message #11040] Thu, 16 August 2007 11:53 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
You may want to look at the QuickTabs from TheIde. See uppsrc/ide/quicktabs
Re: Deleting Tabs [message #11053 is a reply to message #6829] Fri, 17 August 2007 12:44 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Thanks, added to my project. It`s a good solution for tabs, but I haven`t found how to handle it`s events - on user`s creating, switching, deleting tabs.
icon4.gif  Re: Deleting Tabs [message #11088 is a reply to message #6829] Sun, 19 August 2007 11:46 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

::up::
Anyone who used QuickTabs, could you please tell how to handle opening, closing and swithing tabs of QuickTabs in app?
Re: Deleting Tabs [message #11090 is a reply to message #11040] Sun, 19 August 2007 13:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11822
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Thu, 16 August 2007 03:41

It`s very uncomfortable.
Luzr, could you please add functionality for individual tabs removal?


Yes.... anyway, you might try it yourself (I think it is not that complicated) and post a patch Wink

Mirek
Re: Deleting Tabs [message #11110 is a reply to message #6829] Mon, 20 August 2007 13:41 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Added TabCtrl::Remove(int n) method. But didn`t have time for complete testing, for now it seems to work for my application.

bool TabCtrl::Remove(int n)
{
	if (n >= tab.GetCount())
		return false;
	
	if(tab[n].ctrl)
		tab[n].ctrl->Remove();
	if(tab[n].slave)
		tab[n].slave->Remove();
	
	tab.Remove(n);
	if (tab.GetCount())
		Set(sel ? sel-1 : sel);
	else
	{
		x0 = 0;
		CancelMode();
		sel = -1;
		accept_current = false;
		WhenSet();
	}
	SyncTabs();
	Refresh();
	return true;
}


Also, I propose adding WhenSet() call to TabCtrl::Reset() for it just changed selected tab index to -1. It would be more convenient for user to have one uniform handler, than explicit code going right after Reset() in user`s application code.

[Updated on: Mon, 20 August 2007 15:09]

Report message to a moderator

Re: Deleting Tabs [message #11117 is a reply to message #11110] Mon, 20 August 2007 21:03 Go to previous message
mirek is currently offline  mirek
Messages: 11822
Registered: November 2005
Ultimate Member
OK, I have altered it a bit and added to uppsrc.

The most important change (apart from some detail bugfixes) is removal of the first condition. IMO, puttin wrong index here is program logic error and should not be implicitly hidden...

Mirek
Previous Topic: How to resize TabCtrl?
Next Topic: [BUG - FIXED] Add() crashes system
Goto Forum:
  


Current Time: Thu Apr 18 23:21:30 CEST 2019

Total time taken to generate the page: 0.01924 seconds