【发布时间】:2013-05-11 12:03:00
【问题描述】:
各位程序员大家好!我的目标是在 WT 页面 (http://www.webtoolkit.eu/wt) 中嵌入 Ventus 窗口管理器 (http://www.rlamana.es/ventus/)、repo here (https://github.com/rlamana/Ventus) 并运行“简单示例”。我在 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);
}
【问题讨论】:
-
将代码更新为功能版本,还添加了用于创建带有容器小部件的ventus窗口的注释块。
标签: javascript c++ html embed wt