Hi, I am brand new to Wt so please excuse (and help correct) any ignorance on my part.
I am trying to put together a very basic framework using layouts. The
paradigm is the entire web page is a vboxlayout with each major page
component (login, header, content, footer, etc.) is handled by a custom
class with an hboxlayout. Each of these custom classes inherit from
WContainerWidget and have their own layout manager, like so:
#ifndef GCFLOGIN_H
#define GCFLOGIN_H
#include <Wt/WContainerWidget>
#include <Wt/WHBoxLayout>
class GCFLogin : public Wt::WContainerWidget
{
public:
/* functions */
GCFLogin();
/* elements */
Wt::WHBoxLayout* layout;
private:
};
#endif
and so the main app would be something like this:
#include <iostream>
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WVBoxLayout>
#include <Wt/WHBoxLayout>
#include <Wt/WText>
#include "gcf.h"
GCFApplication::GCFApplication(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
std::cout << "GCFApplication starting" << std::endl;
appName = "Grace Christian Fellowship Church";
setTitle(appName);
root()->resize(400, 600);
layout = new Wt::WVBoxLayout();
root()->setLayout(layout);
gcfLogin = new GCFLogin();
//layout->addItem(gcfLogin->layout);
// layout->addLayout(gcfLogin->layout);
root()->addWidget(gcfLogin);
this->instance()->styleSheet().addRule("BODY", "background-color: #FFFFFF;");
this->instance()->styleSheet().addRule("#login", "background-color: #0000FF;
color: #000000; padding: 0.1em 0.5em;");
std::cout << "GCFApplication ending" << std::endl;
}
Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
return new GCFApplication(env);
}
int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, &createApplication);
}
The problem I'm having is that the widgets in my GCFLogin class are not
being rendered; all I see when I run this code is a blank page.
I'm also not sure how the main container (WApplication->root()) and the
"sub"-containers, and the main layout GCF::layout and the sub-layouts
GCFLogin::layout are supposed to hang together. In my current code I'm
just doing an addWidget in the mai app, but I'm not sure if a
GCF::layout->addLayout(GCFLogin->layout) is required (in addition or
instead) or what.
So I'm just guessing in the dark here - I don't see explicit
explanations in the doxygen class documentation that explains this.
Maybe I missed it.
In any case, a little guidance would be much appreciated. I'm attaching
the project files.
--
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com
gcf.cpp
Description: Binary data
#ifndef GCF_H
#define GCF_H
#include <Wt/WVBoxLayout>
#include "gcflogin.h"
class GCFApplication : public Wt::WApplication
{
public:
/* functions */
GCFApplication(const Wt::WEnvironment& env);
private:
/* elements */
std::string appName;
Wt::WVBoxLayout* layout;
/* functions */
GCFLogin* gcfLogin;
void HeaderLayout();
void MenuLayout();
void ContentLayout();
void FooterLayout();
};
#endif
#ifndef GCFLOGIN_H
#define GCFLOGIN_H
#include <Wt/WContainerWidget>
#include <Wt/WHBoxLayout>
class GCFLogin : public Wt::WContainerWidget
{
public:
/* functions */
GCFLogin();
/* elements */
Wt::WHBoxLayout* layout;
private:
};
#endif
gcflogin.cpp
Description: Binary data
------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
