Support #2110
closedWCssStyleSheet Errors
0%
Description
I'm getting errors when running an app on Linux which compiles and runs fine on my local (Windows 7) machine. I don't understand this error or why there are strange characters showing up in the error output:
In file included from /usr/local/include/Wt/WApplication:27:0,
from /home/user/source/app.cpp:5:
/usr/local/include/Wt/WCssStyleSheet:189:3: note: Wt::WCssStyleSheet::WCssStyleSheet()
/usr/local/include/Wt/WCssStyleSheet:189:3: note: candidate expects 0 arguments, 1 provided
/usr/local/include/Wt/WCssStyleSheet:184:14: note: Wt::WCssStyleSheet::WCssStyleSheet(const Wt::WCssStyleSheet&)
/usr/local/include/Wt/WCssStyleSheet:184:14: note: no known conversion for argument 1 from âWt::WLinkâ to âconst Wt::WCssStyleSheet&â
Files
Updated by Bud T over 11 years ago
I've got my style sheets in
/var/www/application/style
My code is pointing to:
this->useStyleSheet(Wt::WCssStyleSheet(Wt::WLink("/style/st.css")));
In wt.conf is my app root defn.:
FcgidInitialEnv WT_APP_ROOT /var/www/application
And, as noted, everything works fine on my Windows 7 machine. Only fails to compile with source code pushed to Linux server.
So, if the files are in my app root, then why does it seem as though Wt can't fine them?
Updated by Wim Dumon over 11 years ago
- Status changed from New to Feedback
Do you have the same Wt version on Linux and Unix? WLink has 'recently' been added.
The strange characters in gcc output are probably because of some gcc add-on that wants to color the output, but that is not correctly interpreted by your terminal program.
Wim.
Updated by Bud T over 11 years ago
My local copy is Wt 3.3.0 while the server is 3.2.1. Is that a problem?
Updated by Wim Dumon over 11 years ago
Correct, WCssStyleSheet did not support external stylesheets in 3.2.1. I believe WApplication::useStyleSheet() does the same.
Wim.
Updated by Bud T over 11 years ago
Ok, thanks. I'll use inline styles until a rebuild is possible. About the styles, though, how do you make the links to the style sheets show up in the page header instead of the body? Right now I've got them within the WApplication type class which I'm instantiating, so they are within the body. Where should they be placed to show up in the page header?
Updated by Wim Dumon over 11 years ago
- Status changed from Feedback to Closed
Wt's behaviour on this point has also changed in the past, but in the latest versions we put styles in the head section instead of the body.
Wim.
Updated by Bud T over 11 years ago
I changed to inline styles locally and the page renders fine. Now, after pushing to Linux server there are again problems:
/home/user/app/source/app.cpp: In member function âvoid App::header()â:
/home/user/app/source/app.cpp:65:88: error: cannot call constructor âWt::WColorâ directly [-fpermissive]
Code including line 65:
#include <Wt/WColor>
...
header->decorationStyle().setBackgroundColor(Wt::WColor(102,204,153,100));
Updated by Bud T over 11 years ago
- File css_linux_vs_windows.png css_linux_vs_windows.png added
Alright, I changed the code and this error is gone... Now I am running this test app on the Linux server. The css is behaving odd. The attached screenshot shows display on Windows machine locally (lower window) and on Linux server (upper window). The text box within the header container is misaligned. Why would this occur?
void header() {
WContainerWidget* header = new WContainerWidget(root());
header->setId("header");
header->resize(800, 100);
// header layout
Wt::WHBoxLayout *hbox = new Wt::WHBoxLayout();
header->setLayout(hbox);
header->setMargin(5);
Wt::WText *item = new Wt::WText("<h1>" + appName + "</h1>");
// temp inline styles
header_color = new Wt::WColor;
header_color->setRgb(102,204,153,100);
header->decorationStyle().setBackgroundColor(*header_color);
box_color = new Wt::WColor;
box_color->setRgb(255,119,61,100);
item->decorationStyle().setBackgroundColor(*box_color);
//header->setStyleClass("yellow-box");
//item->setStyleClass("green-box");
hbox->addWidget(item);