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 » Multiple Layouts
Re: Multiple Layouts [message #33889 is a reply to message #33888] Wed, 21 September 2011 20:11 Go to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
jady wrote on Wed, 21 September 2011 13:48

I'm not able to find any tutorials or information on what I'm trying to accomplish. If I've missed it, please link me to it.

I'd like to have multiple layouts and switch between them using buttons. I saw the example applications doing it for tabs, but I can't figure out how to apply this to buttons.


Realize the layout on ParentCtrl, Add all such ParentCtrls to your main dialog, then hide/show these ParentCtrls upon Button push.

Something like:


struct MyDlg : TopWindow {
    WithSubDlg1Layout<ParentCtrl> subdlg1;
    WithSubDlg2Layout<ParentCtrl> subdlg2;

    void Show1() { subdlg1.Show(); subdlg2.Hide(); }
    void Show2() { subdlg1.Hide(); subdlg2.Show(); }

    Button b1, b2; // Placing buttons is omitted

    typedef MyDlg CLASSNAME;

    MyDlg() {
       CtrlLayout(subdlg1);
       CtrlLayout(subdlg2);
       Add(subdlg1.SizePos());
       Add(subdlg2.SizePos());
       b1 <<= THISBACK(Show1);
       b2 <<= THISBACK(Show2);
       Show1();
    }
};


There are many variations to this theme and some more things to fix (e.g. focus), but I guess this is enough to get the idea.

Layout is nothing magical, that With* template only creates structure with all widgets defined in Layout (except those without the type) and CtrlLayout call only setups positions and attributes.

Mirek
 
Read Message
Read Message
Previous Topic: Dynamic Graphs Functions
Next Topic: CPP file dependency
Goto Forum:
  


Current Time: Mon Aug 04 21:43:41 CEST 2025

Total time taken to generate the page: 0.07835 seconds