Hi,
I'm trying to come to grips with layout using Wt, but it
is all a bit maddening.My current problem is to do with how a repeated background image doesn't repeat properly when a region is scrolled. Attached is a simple example based on hello.C. Using a Firefox like browser (SeaMonkey 2.0.9) with Javascript enabled, I see the following behaviour: Initially the strip and the text look OK. If the widow is narrowed, the text expands vertically and a scroll bar is added. If the window is scrolled down, the graphic strip is not extended, but is blank. It is extended if the page is reloaded. How do I fix this ? If Javascript is turned off, the page behaves properly, with the graphic strip being extended as required to match the height of the text. Strangely, it continues to work correctly if Javascript is turned on again and the page reloaded! One has to restart the browser to return to the original behaviour. Looking at it with IE (V 8.0.6001.18702) one sees additional problems. Not only is there the problem of the strip not being extended, but the text is overwriting the graphics! The horizontal layout is not being obeyed! Any suggestions of how to proceed, gratefully accepted.. Graeme Gill.
/*
* Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.
*
* See the LICENSE file for terms of use.
*/
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WHBoxLayout>
#include <Wt/WVBoxLayout>
#include <Wt/WText>
#include <Wt/WImage>
// c++0x only, for std::bind
// #include <functional>
using namespace Wt;
/*
* A simple hello world application class which demonstrates how to react
* to events, read input, and give feed-back.
*/
class HelloApplication : public WApplication
{
public:
HelloApplication(const WEnvironment& env);
private:
WHBoxLayout *m_layout; // Horizontal layout
WContainerWidget *m_vstrip; // Left vertical graphical strip
WText *m_body; // Right body text
};
/*
* The env argument contains information about the new session, and
* the initial request. It must be passed to the WApplication
* constructor so it is typically also an argument for your custom
* application constructor.
*/
HelloApplication::HelloApplication(const WEnvironment& env)
: WApplication(env)
{
// Create the horizontal Layout
m_layout = new WHBoxLayout();
root()->setLayout(m_layout);
// Make it scroll if the text overflows
root()->setOverflow(Wt::WContainerWidget::OverflowAuto);
// The left hand vertical graphic strip
m_vstrip = new WContainerWidget();
m_vstrip->decorationStyle().setBackgroundImage("vstrip.jpg",
Wt::WCssDecorationStyle::RepeatY);
// If we don't set a minimum size, the strip vanishes
m_vstrip->setMinimumSize(Wt::WLength("40px"), Wt::WLength("1px"));
root()->addWidget(m_vstrip);
m_layout->addWidget(m_vstrip, 0); // Minimize strip width
// Some text to the right of the graphical strip
m_body = new WText("The first line starts here. xxxxxxxxxxxxxxx"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The quick brown fox jumps over the lazy dog"
"The last line ends here. xxxxxxxxxxxxxxxxxx");
root()->addWidget(m_body);
m_layout->addWidget(m_body, 1); // Maximize text width
}
WApplication *createApplication(const WEnvironment& env)
{
/*
* You could read information from the environment to decide whether
* the user has permission to start a new application
*/
return new HelloApplication(env);
}
int main(int argc, char **argv)
{
/*
* Your main method may set up some shared resources, but should then
* start the server application (FastCGI or httpd) that starts listening
* for requests, and handles all of the application life cycles.
*
* The last argument to WRun specifies the function that will instantiate
* new application objects. That function is executed when a new user surfs
* to the Wt application, and after the library has negotiated browser
* support. The function should return a newly instantiated application
* object.
*/
return WRun(argc, argv, &createApplication);
}
<<attachment: vstrip.jpg>>
------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
