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 » Community » Newbie corner » Adding Tab and Slaves to a TabCtrl
Re: Adding Tab and Slaves to a TabCtrl [message #48455 is a reply to message #48453] Tue, 04 July 2017 14:12 Go to previous message
omari is currently offline  omari
Messages: 266
Registered: March 2010
Experienced Member
1 - the new .Lay
LAYOUT(SettingsLayout, 250, 300)
	ITEM(TabCtrl, tab_settings, LeftPosZ(0, 250).TopPosZ(0, 300))
END_LAYOUT

LAYOUT(languageCtrlLayout, 256, 328)
	ITEM(Button, b_ok, SetLabel(t_("OK")).LeftPosZ(16, 100).BottomPosZ(22, 30))
	ITEM(Button, b_cancel, SetLabel(t_("Cancel")).RightPosZ(16, 100).BottomPosZ(22, 30))
	ITEM(LNGCtrl, lng_language, LeftPosZ(36, 190).TopPosZ(18, 30))
	ITEM(StaticText, txt_lang_check, SetText(t_("Press the preview button.")).SetFont(StdFontZ(11)).LeftPosZ(36, 190).TopPosZ(58, 30))
	ITEM(Button, b_preview, SetLabel(t_("Preview")).LeftPosZ(36, 50).TopPosZ(93, 20))
	ITEM(StaticText, txt_preview, SetText(t_("English text")).SetAlign(ALIGN_CENTER).SetFont(StdFontZ(16)).SetFrame(ThinInsetFrame()).LeftPosZ(36, 190).TopPosZ(118, 100))
END_LAYOUT



2 - in SettingsLayout class, add the instance
class SettingsLayout : public ..
{
...
    WithlanguageCtrlLayout<ParentCtrl> languageCtrl;
...
};


3 - add a CtrlLayout in the constructor, and refere to tab widget by languageCtrl.x:
SettingsWindow::SettingsWindow()
{
    m_language = GetCurrentLanguage();
    
    CtrlLayout(*this, t_("Settings"));
    CtrlLayout(languageCtrl);                  // Line Added
    InitTabs();
        
    languageCtrl.b_ok <<= THISBACK(OnClickOK);  // line modified
    languageCtrl.b_cancel <<= THISBACK(OnClickCancel);   // line modified
}


4 - InitTab:
void SettingsWindow::InitTabs()
{


    tab_settings.Add(languageCtrl.SizePos(), t_("Language"));
    languageCtrl.txt_preview.Show(false);
    languageCtrl.b_preview <<= THISBACK(OnClickPreview);
    
    m_retriever // header -> CtrlRetriever m_retriever
        (languageCtrl.lng_language, m_language) // header -> int m_language
    ;
}


regards
omari.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Switching layout inside class
Next Topic: Example Serial pak
Goto Forum:
  


Current Time: Wed May 15 09:26:17 CEST 2024

Total time taken to generate the page: 0.02385 seconds