javascript - 在 WT 中嵌入 Ventus

标签 javascript c++ html embed wt

各位程序员大家好!我的目标是在 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/

相关文章:

javascript - Discord.js();如何发送文件(总是发送0字节文件?)

c++ - 打包 OpenCV Dll 以分发 C++ DLL

c++ - Netbeans 无法识别 igraph 函数

html - 通过阻止 GET/POST 中的 HTML 标记来防止 XSS

java - Wicket 6 NonCachingImage 未在 HTML 中显示

javascript - 为什么在按下 shift 键时没有触发 'click' 事件?

javascript - 聚集累积内部对象

javascript - 我想从我覆盖的 sw-component 继承 Prop

c++ - 无法找到异常源 : cudaError_enum at memory location

javascript - 无法从 MapQuest API 返回的 JSON 中检索值