Table of Contents
- How do I create a simple Application?
- How do I speed things up?
- How to hide the browsers context menu
- Is it possible to mix widgets with plain HTML?
- I'd like to open a QxNativeWindow without the statusbar.
- The listview seems to destroy my layout
- PNG images are not shown in Internet Explorer?
- Can I add the same widget several times?
- How to center a window on screen?
- How to set the focus to a widget in a window?
- How to set a QxTabView autosized
- What's the minimum set of needed images
- How to calculate the width that a given text occupies
- How to implement a context-menu
User FAQ
Here you will be able to find answers to questions from users that have been asked previously. If your question is not answered here, please be sure to check our Documentation (0.6.x) and Mailing lists for more help.
Please also take a look at the other FAQs:
How do I create a simple Application?
A good starting point is our user_manual.
How do I speed things up?
This depends on two factors:
- The time it takes for a user to download the files: A user’s internet connection and overall ability to transmit information will make the first impact on qooxdoo’s load time.
- The speed of a user’s computer: Once downloaded, qooxdoo must be loaded by the web browser and initialized. Like all JavaScript based applications this process can be quite CPU intensive.
How to hide the browsers context menu
If you use Firefox, make sure the option Preferences → Content → Enable Javascript →
Advanced → Disable or replace context menus is checked, so that context menus are not hidden by the browsers default context menu.
Is it possible to mix widgets with plain HTML?
Yes, it is. Please have a look at the examples which use the qx.ui.basic.Inline object (with an example here). qooxdoo has some dependecies on css and html doctype which need to be satisfied.
I'd like to open a QxNativeWindow without the statusbar.
This is because of the security-settings of the browser. In IE you can add the site to the trusted sites. After doing this, the statusbar is gone.
The listview seems to destroy my layout
Yes, currently there is a bug regarding qx.ui.listview.ListView inside complex layouts. qx.ui.listview.ListView only works really stable currently using fixed width/height dimensions inside a simple canvas layout. Sorry for that. We will try to fix this with further versions, probably with version 0.8.
The table widget is more robust in complex dynamic layouts and may be used as a replacement.
PNG images are not shown in Internet Explorer?
SP2 introduced a new ActiveX setting, that may cause your IE to not display PNGs: if “Binary and script behaviors” in your browser settings is disabled, QxImage will not be able to show any PNG. It simply keeps displaying an invisible blank.gif that is preloaded to fix the well-known alpha transparency bug in IE6 or below. Please make sure you enabled this setting.
Can I add the same widget several times?
You cannot add the same widget to different or the same containers. You have to clone it. If you don’t do so, only the last one will be rendered.
Instead of:
var label = new qx.ui.basic.Label('Hi'); var box1 = new qx.ui.layout.BoxLayout(); box1.add(label); var box2 = new qx.ui.layout.BoxLayout(); box2.add(label);
you must use this:
var label = new qx.ui.basic.Label('Hi'); var box1 = new qx.ui.layout.BoxLayout(); box1.add(label); var box2 = new qx.ui.layout.BoxLayout(); box2.add(label.clone());
How to center a window on screen?
Here is the solution:
var win = new qx.ui.window.Window(); .... win.addEventListener("appear",function(){ this.centerToBrowser(); }, win); rootDocument.add(win); win.open();
This solution works even if we don’t know the real size of the window, because it depends on its content.
Before the window is shown and know its real size, we place it at the center.
How to set the focus to a widget in a window?
Here is the solution:
var win = new qx.ui.window.Window(); var field = new qx.ui.form.TextField; win.add(field) ... win.addEventListener("appear",function() { field.focus(); }, win); rootDocument.add(win); win.open();
We must set the focus in the appear event of the window (before the window is shown). Otherwise it doesn’t work.
How to set a QxTabView autosized
Here is the solution:
var tv = new qx.ui.pageview.tabview.TabView; tv.set({ width : 'auto', height : 'auto' }); tv.getPane().setHeight('auto'); // This step is important var b1 = new qx.ui.pageview.tabview.Button('One'); var b2 = new qx.ui.pageview.tabview.Button('Two'); tv.getBar().add(b1, b2); var p1 = new qx.ui.pageview.tabview.Page(b1); p1.add(new qx.ui.basic.Atom('Page one')); var p2 = new qx.ui.pageview.tabview.Page(b2); p2.add(new qx.ui.basic.Atom('Page two')); tv.getPane().add(p1, p2); tv.getBar().add(b1, b2);
What's the minimum set of needed images
The following directory are needed:
- themes/widgets
- All files
- themes/icons/crystalsvg/16
- button-cancel.gif
- button-ok.gif
- If using trees:
- file-new.gif,
- folder.gif,
- folder-open.gif
How to calculate the width that a given text occupies
You can use a code similar to this:
var neededWidth = new qx.ui.basic.Label('myText').getPreferredBoxWidth()
How to implement a context-menu
To implement a context-menu you can use a code as showed in the following example:
// set up a command var com = new qx.client.Command; com.addEventListener("execute", function(e){ this.debug("What object i've clicked on?"); // show the opening widget this.debug("e.getData() = " + e.getData().getParentMenu().getOpener()); }, this); // set up the context-menu var cmenu = new qx.ui.menu.Menu; // setup the button and add the command var m_1 = new qx.ui.menu.Button("Show Target", null, com); cmenu.add(m_1); cmenu.addToDocument(); // show the context-menu image.setContextMenu(cmenu); image.addEventListener("contextmenu", function(e) { this.getContextMenu().setLeft(e.getClientX()); this.getContextMenu().setTop(e.getClientY()); // this step is important - set the image as the opening widget this.getContextMenu().setOpener(this); this.getContextMenu().show(); }, image);
The implementation of the context-menu will be rewritten to allow an easier use of this feature. In the new implementation the last section should not be needed. With a correct implementation of the context-menu only the call of
image.setContextMenu(cmenu);
should be needed to setup and use a context-menu.
