在WT中嵌入Ventus [英] Embedding Ventus in WT

查看:245
本文介绍了在WT中嵌入Ventus的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好伙伴程序员!我的目标是嵌入Ventus窗口管理器( http://www.rlamana.es/ventus/ ) ),在这里( https://github.com/rlamana/Ventus )在WT页面(< a href =http://www.webtoolkit.eu/wt =nofollow> http://www.webtoolkit.eu/wt )并获取简单示例运行。我有Ventus窗口嵌入在WT页面,但我有一个造型问题的窗口。我猜这是一个与Ventus和WT的CSS的冲突。这让我来到这里,因为CSS不是我的强项。我使用visual studio2010为我的开发,我有最小的一个WT项目运行,基本上hello世界的应用程序与所有的小部件撕裂了它。我已经包括了simple.html示例使用的所有CSS和JS,并一直试图找出如何使它与WT一起使用。任何帮助将非常感谢!

  void HelloApplication :: InitInterface()
{
// Include 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);

//包含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(); //是在JS中执行时将是元素的文本字符串


std :: string command = ventus_widget_ref +.wm = new Ventus.WindowManager();;
//创建窗口管理器
ventus_widget-> doJavaScript(command);

command = ventus_widget_ref +.wm.createWindow({title:'Ventus',x:10,y:10,width:500,height:500}

//您还可以通过创建容器窗口小部件和fromQuery函数创建新窗口
// 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();;
//然后可以像任何其他的WT容器一样向ventus窗口添加小部件
// app_window-> addWidget(app.get());

//创建窗口
ventus_widget-> doJavaScript(command);
}


解决方案

当使用WT而不是使用require来加载CSS文件时,使用useStyleSheet。


Hello fellow programmers! My goal is to embed a Ventus window manager (http://www.rlamana.es/ventus/), repo here (https://github.com/rlamana/Ventus) in a WT page (http://www.webtoolkit.eu/wt) and get the "Simple Example" running. I have the ventus window embedded in the WT page, however I am having a styling problem with the window. My guess this is a conflict with CSS of Ventus and WT. Which brings me here, as CSS is not my strong point. I am using visual studio2010 for my development, and I have the bare minimum of a WT project running, basically the hello world app with all the widgets ripped out of it. I've included all the CSS and JS that the simple.html example uses, and have been trying to figure out how to make it work with WT. Any help would be much appreciated!

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);
}

解决方案

Finally figured it out. When using WT instead of using "require" for loading CSS files, use "useStyleSheet".

这篇关于在WT中嵌入Ventus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆