Home » U++ Library support » TabCtrl » TabDlg propose
TabDlg propose [message #19618] |
Tue, 23 December 2008 14:41 |
|
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 #19678 is a reply to message #19675] |
Sun, 04 January 2009 19: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;
}
[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 |
|
mirek
Messages: 13980 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 |
|
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);"!
|
|
|
Goto Forum:
Current Time: Thu May 23 17:04:10 CEST 2024
Total time taken to generate the page: 0.02138 seconds
|