Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Application Wizard based?
Application Wizard based? [message #22389] |
Thu, 09 July 2009 20:27 |
kbyte
Messages: 87 Registered: July 2008
|
Member |
|
|
Hi all,
My question is:
Is there any simple way to make a wizard type application with upp or do we have to make all the things from the ground up?
If not, which is the better option:
1-have lots of dialogs (close one open other)
2-one dialog with lots of pannels (one hide, other shown)
By wizard app i mean those apps that have the next, previous buttons.
Thanks a lot
Alex
|
|
|
|
|
Re: Application Wizard based? [message #28316 is a reply to message #22389] |
Fri, 27 August 2010 09:18 |
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
|
|
|
Re: Application Wizard based? [message #28327 is a reply to message #22389] |
Fri, 27 August 2010 19:35 |
|
Hi sevenjay & Alex,
I just recently developed a class for easy handling wizards, since I needed one too. It might be useful for you as well
It is really simple, just one file actually, in my opinion it doesn't even deserve it's own package, but for now I put it here like that. It uses templated class which takes 2-10 parameters similar to WithStepOneLayout<ParentCtrl> and provides the basic handling of actions like next, previous, finish etc. The biggest advantage IMHO is, that the class is, unlike many things in U++, fully DOCUMENTED
It uses similar concept as the code posted above, just taken it little further, using the templates and more general approach on some things. E.g. ability to skip some steps, modifying the dialog while running using WhenStep callback and few others.
If you have any trouble using it, just ask. Also let me now what you think of it and any ideas how to make it better.
Best regards,
Honza
[Updated on: Fri, 27 August 2010 19:38] Report message to a moderator
|
|
|
|
Re: Application Wizard based? [message #28524 is a reply to message #28520] |
Sun, 05 September 2010 23:12 |
|
281264 wrote on Sun, 05 September 2010 22:19 | Honza,
Where is the file?
Javier
|
Oups, looks like I forgot to upload it Or some cyber daemon stole it
Anyway, here it is
Best regards,
Honza
-
Attachment: Wizard.zip
(Size: 3.57KB, Downloaded 233 times)
|
|
|
Goto Forum:
Current Time: Fri Mar 29 12:29:14 CET 2024
Total time taken to generate the page: 0.01182 seconds
|