各位程序员大家好!我的目标是在 WT 页面 (http://www.rlamana.es/ventus/) 中嵌入 Ventus 窗口管理器 (https://github.com/rlamana/Ventus)、repo here (http://www.webtoolkit.eu/wt) 并运行“简单示例”。我在 WT 页面中嵌入了 ventus 窗口,但是该窗口存在样式问题。我猜这是与 Ventus 和 WT 的 CSS 冲突。这让我来到这里,因为 CSS 不是我的强项。我正在使用 visual studio2010 进行开发,并且我运行了最低限度的 WT 项目,基本上是 hello world 应用程序,其中包含所有小部件。我已经包含了 simple.html 示例使用的所有 CSS 和 JS,并且一直在尝试弄清楚如何使其与 WT 一起工作。任何帮助将不胜感激!
void HelloApplication::InitInterface()
{
//Include the CSS
wApp->useStyleSheet("Ventus/examples/simple/css/normalize.css");
wApp->useStyleSheet("Ventus/examples/simple/css/simple.css");
wApp->useStyleSheet("Ventus/build/ventus.css");
wApp->useStyleSheet("Ventus/examples/simple/css/browseralert.css");
//Include the JS
wApp->require("Ventus/vendor/modernizr.js");
wApp->require("Ventus/vendor/jquery.js");
wApp->require("Ventus/vendor/handlebars.js");
wApp->require("Ventus/build/ventus.js");
WContainerWidget* root = this->root();
WContainerWidget* ventus_widget = new WContainerWidget(root);
//Widget ref
std::string ventus_widget_ref = ventus_widget->jsRef(); // is a text string that will be the element when executed in JS
std::string command = ventus_widget_ref + ".wm = new Ventus.WindowManager();";
//Create the window manager
ventus_widget->doJavaScript(command);
command = ventus_widget_ref + ".wm.createWindow({title: 'Ventus', x: 10, y: 10, width: 500, height: 500}).open();";
//You may also create new windows by creating container widgets and fromQuery function
//WContainerWidget* app_window = new WContainerWidget(wApp->root());
//command = ventus_widget_ref + ".wm.createWindow.fromQuery(" + app_window->jsRef() + ", {title: 'Ventus', x: 10, y: 10, width: 500, height: 500}).open();";
//You can then add widgets to the ventus window like any other WT container
//app_window->addWidget(app.get());
//Create a window
ventus_widget->doJavaScript(command);
}
最佳答案
终于明白了。当使用 WT 而不是使用“require”来加载 CSS 文件时,请使用“useStyleSheet”。
关于javascript - 在 WT 中嵌入 Ventus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16590073/