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 » TabDlg propose
TabDlg propose [message #19618] Tue, 23 December 2008 14:41 Go to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

I propose by default change tab size on resize tabctr;
Need to change code from:
TabCtrl::Item& TabDlg::Add0(Ctrl& tab, const char *text)
{
	Size tsz = max(tab.GetRect().GetSize(), sz);
	TabCtrl::Item& m = tabctrl.Add(tab, text);
	if(tsz != sz) {
		sz = tsz;
		Rearrange();
	}
	return m;
}

to
TabCtrl::Item& TabDlg::Add0(Ctrl& tab, const char *text)
{
	Size tsz = max(tab.GetRect().GetSize(), sz);
	tab.SizePos();
	TabCtrl::Item& m = tabctrl.Add(tab, text).Slave(&tab);
	if(tsz != sz) {
		sz = tsz;
		Rearrange();
	}
	return m;
}

add: code "tab.SizePos();" and ".Slave(&tab)"; It is useful when the TabDlg is sizeable!
Re: TabDlg propose [message #19675 is a reply to message #19618] Sun, 04 January 2009 15:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11991
Registered: November 2005
Ultimate Member
Not sure:

Calling SizePos on tab component is quite easy. OTOH, sometimes you might want the tab not to be resized - and doing this, you are loosing this option.
Re: TabDlg propose [message #19678 is a reply to message #19675] Sun, 04 January 2009 19:26 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

luzr wrote on Sun, 04 January 2009 16:02

Not sure:

Calling SizePos on tab component is quite easy. OTOH, sometimes you might want the tab not to be resized - and doing this, you are loosing this option.

Sorry for stupid question...
How can i do? i tryed, but not work:

TabDlg dlg;
WithOptionsGeneralLayout<ParentCtrl> tab_options_general;
tab_options_general.SizePos();
dlg.Add(tab_options_general, t_("General")).Slave(&tab_options_general);


edit: May be add third parameter, "bool slave = false"?
In TabCtrl.h
class TabDlg : public TopWindow {
...
	TabCtrl::Item& Add0(Ctrl& tab, const char *text, bool isslave = false);
...
	TabCtrl::Item& Add(T& tab, const char *text, bool isslave = false)                   { CtrlLayout(tab); return Add0(tab, text, isslave); }
...
	TabDlg&  operator()(T& tab, const char *text, bool isslave = false)                  { Add(tab, text, isslave); return *this; }


In TabCtrl.cpp
TabCtrl::Item& TabDlg::Add0(Ctrl& tab, const char *text, bool isslave)
{
	Size tsz = max(tab.GetRect().GetSize(), sz);
	if(isslave)
		tab.SizePos();
	
	TabCtrl::Item& m = tabctrl.Add(tab, text);
	
	if(isslave)
		m.Slave(&tab);
	
	if(tsz != sz) {
		sz = tsz;
		Rearrange();
	}
	return m;
}

[Updated on: Sun, 04 January 2009 21:50]

Report message to a moderator

Re: TabDlg propose [message #19692 is a reply to message #19678] Mon, 05 January 2009 22:41 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11991
Registered: November 2005
Ultimate Member
tojocky wrote on Sun, 04 January 2009 13:26

luzr wrote on Sun, 04 January 2009 16:02

Not sure:

Calling SizePos on tab component is quite easy. OTOH, sometimes you might want the tab not to be resized - and doing this, you are loosing this option.

Sorry for stupid question...
How can i do? i tryed, but not work:

TabDlg dlg;
WithOptionsGeneralLayout<ParentCtrl> tab_options_general;
tab_options_general.SizePos();
dlg.Add(tab_options_general, t_("General")).Slave(&tab_options_general);


edit: May be add third parameter, "bool slave = false"?
In TabCtrl.h
class TabDlg : public TopWindow {
...
	TabCtrl::Item& Add0(Ctrl& tab, const char *text, bool isslave = false);
...
	TabCtrl::Item& Add(T& tab, const char *text, bool isslave = false)                   { CtrlLayout(tab); return Add0(tab, text, isslave); }
...
	TabDlg&  operator()(T& tab, const char *text, bool isslave = false)                  { Add(tab, text, isslave); return *this; }


In TabCtrl.cpp
TabCtrl::Item& TabDlg::Add0(Ctrl& tab, const char *text, bool isslave)
{
	Size tsz = max(tab.GetRect().GetSize(), sz);
	if(isslave)
		tab.SizePos();
	
	TabCtrl::Item& m = tabctrl.Add(tab, text);
	
	if(isslave)
		m.Slave(&tab);
	
	if(tsz != sz) {
		sz = tsz;
		Rearrange();
	}
	return m;
}



OK, I have changed my mind. Original idea is quite ok.

Applied.

Mirek
Re: TabDlg propose [message #19701 is a reply to message #19692] Tue, 06 January 2009 11:42 Go to previous message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

luzr wrote on Mon, 05 January 2009 23:41

OK, I have changed my mind. Original idea is quite ok.

Applied.

Mirek

Thank you for correct changes!
sorry for rendundands propouse code ".Slave(&tab);"!
Previous Topic: GetTab as protected or public
Next Topic: TabCtrl FIX
Goto Forum:
  


Current Time: Sun Aug 18 19:15:57 CEST 2019

Total time taken to generate the page: 0.00644 seconds