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 » U++ Widgets - General questions or Mixed problems » Application Wizard based?
Re: Application Wizard based? [message #28316 is a reply to message #22389] Fri, 27 August 2010 09:18 Go to previous messageGo to previous message
sevenjay is currently offline  sevenjay
Messages: 30
Registered: October 2008
Location: Taiwan
Member
I have the same request.
I have done it not very good, maybe it could be better.
Hope helpful.
WizardPage.h
#ifndef _WizardPage_WizardPage_h
#define _WizardPage_WizardPage_h

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define LAYOUTFILE <WizardPage/WizardPage.lay>
#include <CtrlCore/lay.h>

class WizardPage : public WithWizardPageLayout<TopWindow> {
	WithPage1Layout<ParentCtrl> Page1;
	WithPage2Layout<ParentCtrl> Page2;
	WithPage3Layout<ParentCtrl> Page3;
	Array<ParentCtrl*> pageList;
	int in_page;
	void ClickNext();
public:
	typedef WizardPage CLASSNAME;
	WizardPage();
};

#endif

main.cpp
#include "WizardPage.h"

WizardPage::WizardPage()
{
	CtrlLayout(*this, "Window title");
	CtrlLayout(Page1);
	pcPageBox.Add(Page1);
	pageList.Add(&Page1);
	CtrlLayout(Page2);
	pcPageBox.Add(Page2);
	pageList.Add(&Page2);
	CtrlLayout(Page3);
	pcPageBox.Add(Page3);
	pageList.Add(&Page3);
	Page1.Hide();
	Page2.Hide();
	Page3.Hide();
	in_page=1;
	pageList[in_page-1]->Show();
	
	
	btnNext<<=THISBACK(ClickNext);
}
void WizardPage::ClickNext()
{
	if(pageList.GetCount()>in_page)
	{
		pageList[in_page-1]->Hide();
		++in_page;
		pageList[in_page-1]->Show();
	}
}

GUI_APP_MAIN
{
	WizardPage().Run();
}

WizardPage.lay
LAYOUT(WizardPageLayout, 424, 228)
	ITEM(Button, btnNext, SetLabel(t_("Next")).LeftPosZ(316, 56).TopPosZ(200, 15))
	ITEM(ParentCtrl, pcPageBox, LeftPosZ(32, 356).TopPosZ(36, 148))
END_LAYOUT

LAYOUT(Page1Layout, 400, 200)
	ITEM(EditString, dv___0, LeftPosZ(132, 64).TopPosZ(40, 19))
	ITEM(StaticText, dv___1, SetText(t_("This is page 1")).LeftPosZ(8, 160).TopPosZ(0, 19))
END_LAYOUT

LAYOUT(Page2Layout, 400, 200)
	ITEM(Option, dv___0, SetLabel(t_("test")).LeftPosZ(32, 56).TopPosZ(48, 16))
	ITEM(StaticText, dv___1, SetText(t_("This is page 2")).LeftPosZ(16, 160).TopPosZ(8, 19))
END_LAYOUT

LAYOUT(Page3Layout, 400, 200)
	ITEM(StaticText, dv___0, SetText(t_("This is page 3")).LeftPosZ(16, 160).TopPosZ(44, 19))
	ITEM(LabelBox, dv___1, LeftPosZ(56, 76).TopPosZ(64, 60))
END_LAYOUT
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Wider scrollbars
Next Topic: Dockable toolbars
Goto Forum:
  


Current Time: Mon May 13 21:03:35 CEST 2024

Total time taken to generate the page: 0.02112 seconds