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 » Hide tab in TabCtrl
Hide tab in TabCtrl [message #25579] Mon, 01 March 2010 17:42 Go to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello all

Is it possible to have a hidden tab in TabCtrl ?


Best regards
Iñaki
Re: Hide tab in TabCtrl [message #25590 is a reply to message #25579] Tue, 02 March 2010 19:03 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Right now, you can remove it (and reinsert later).
Re: Hide tab in TabCtrl [message #25595 is a reply to message #25590] Tue, 02 March 2010 21:03 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
luzr wrote on Tue, 02 March 2010 19:03

Right now, you can remove it (and reinsert later).


Smile

Hello Mirek

It was because some times it will be visible and sometimes it will not, but in all times I wanted to use some data inside.

Anyway I will do it other way (more efficient than using a Ctrl to store data Smile)


Best regards
Iñaki
Re: Hide tab in TabCtrl [message #25596 is a reply to message #25595] Tue, 02 March 2010 22:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Tue, 02 March 2010 15:03

luzr wrote on Tue, 02 March 2010 19:03

Right now, you can remove it (and reinsert later).


Smile

Hello Mirek

It was because some times it will be visible and sometimes it will not, but in all times I wanted to use some data inside.



Hm, and what is the problem?

You usually have all tabs as variables of master dialog class. Them being part of TabCtrl or not is irrelevant to the data inside.

Mirek
Re: Hide tab in TabCtrl [message #25600 is a reply to message #25596] Wed, 03 March 2010 09:13 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
luzr wrote on Tue, 02 March 2010 22:20

koldo wrote on Tue, 02 March 2010 15:03

luzr wrote on Tue, 02 March 2010 19:03

Right now, you can remove it (and reinsert later).


Smile

Hello Mirek

It was because some times it will be visible and sometimes it will not, but in all times I wanted to use some data inside.



Hm, and what is the problem?

You usually have all tabs as variables of master dialog class. Them being part of TabCtrl or not is irrelevant to the data inside.

Mirek


Hello Mirek

You are right, tab contents are outside TabCtrl.

The problem is that if I remove a tab, the WhenAction() functions will not know which tab has been clicked.

Could it be possible to have something like this in TabCtrl class ?:

In class Item, to know the text of a tab:
String GetText() {return text;}; 


In class TabCtrl, to now the id of a tab with a title:
int GetItemId(const char *title) {	
	for (int i = 0; i < GetCount(); ++i) {
		if (GetItem(i).GetText() == title)
			return i;
	}
	return -1;
}


Best regards
Iñaki
Re: Hide tab in TabCtrl [message #25601 is a reply to message #25600] Wed, 03 March 2010 10:03 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, I guess TabCtrl was lacking in this kind of operation. I think these methods might improve situation:

	int  Find(const Ctrl& slave) const;
	void Set(Ctrl& slave);

	TabCtrl::Item& Insert(Ctrl& before_slave);
	TabCtrl::Item& Insert(Ctrl& before_slave, const char *text);
	TabCtrl::Item& Insert(Ctrl& before_slave, const Image& m, const char *text);
	TabCtrl::Item& Insert(Ctrl& before_slave, Ctrl& slave, const char *text);
	TabCtrl::Item& Insert(Ctrl& before_slave, Ctrl& slave, const Image& m, const char *text);

	void  Remove(Ctrl& slave);


Still, maybe we should add visibility flag too (but its a bit more difficult and I do not have enough time now).

Mirek
Re: Hide tab in TabCtrl [message #25602 is a reply to message #25601] Wed, 03 March 2010 10:26 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
luzr wrote on Wed, 03 March 2010 10:03

Well, I guess TabCtrl was lacking in this kind of operation. I think these methods might improve situation:

	int  Find(const Ctrl& slave) const;
	void Set(Ctrl& slave);

	TabCtrl::Item& Insert(Ctrl& before_slave);
	TabCtrl::Item& Insert(Ctrl& before_slave, const char *text);
	TabCtrl::Item& Insert(Ctrl& before_slave, const Image& m, const char *text);
	TabCtrl::Item& Insert(Ctrl& before_slave, Ctrl& slave, const char *text);
	TabCtrl::Item& Insert(Ctrl& before_slave, Ctrl& slave, const Image& m, const char *text);

	void  Remove(Ctrl& slave);


Still, maybe we should add visibility flag too (but its a bit more difficult and I do not have enough time now).

Mirek

Thank you Mirek

Tested. It runs well and it is simpler and better behaved.

With this now I do not need visibility flag Smile.


Best regards
Iñaki
Re: Hide tab in TabCtrl [message #25604 is a reply to message #25602] Wed, 03 March 2010 10:36 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Oh, just a little problem.

Compiling with MSC this:
int  TabCtrl::Find(const Ctrl& slave) const
{
	for(int i = 0; i < tab.GetCount(); i++)
		if(tab[i].slave == &slave)
			return i;
}


I get this:
warning C4715: 'Upp::TabCtrl::Find' : not all control paths return a value


Best regards
Iñaki
Re: Hide tab in TabCtrl [message #25606 is a reply to message #25604] Wed, 03 March 2010 11:56 Go to previous message
chickenk is currently offline  chickenk
Messages: 169
Registered: May 2007
Location: Grenoble, France
Experienced Member
Could this solve the situation ?
int  TabCtrl::Find(const Ctrl& slave) const
{
	for(int i = 0; i < tab.GetCount(); i++)
		if(tab[i].slave == &slave)
			return i;
	return -1;
}
regards,
Lionel
Previous Topic: Disappearing tabs in TabCtrl
Next Topic: How to change tabctrl background color ?
Goto Forum:
  


Current Time: Thu Mar 28 09:51:47 CET 2024

Total time taken to generate the page: 0.01507 seconds