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);
}
已將代碼更新爲功能版本,還添加了用於使用容器小部件創建ventus窗口的註釋塊。 – user2115945