2013-05-16 41 views
0

各位程序员,您好!我的目标是在WT页面(http://www.webtoolkit.eu/wt)中嵌入一个Ventus窗口管理器(http://www.rlamana.es/ventus/),这里的回购(https://github.com/rlamana/Ventus),并获得“简单示例”运行。我在WT页面中嵌入了ventus窗口,但是我在窗口中遇到了样式问题。我猜这是与Ventus和WT的CSS的冲突。这使我感到这里,因为CSS不是我的强项。我正在使用visual studio2010进行开发,并且我最低限度运行了一个WT项目,基本上是hello world应用程序,其中包含所有小部件。我已经包含了simple.html示例使用的所有CSS和JS,并一直试图弄清楚如何使它与WT协同工作。任何帮助将非常感激!在WT中嵌入Ventus

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

已将代码更新为功能版本,还添加了用于使用容器小部件创建ventus窗口的注释块。 – user2115945

回答

1

终于搞明白了。当使用WT代替使用“require”加载CSS文件时,请使用“useStyleSheet”。