Hi,

I am designing my first webapp with qooxdoo and after reaching a phase where I 
am quite satisfied with how the app looks, I decided to refactoreize code a 
bit and make it a little bit more readable -- till now everything was inside 
main():

What I am trying to achieve is -- more or less represented by the following 
ascii-art scheme (use fixed-size font):

//        document
// +--------------------------------+
// |                                |
// |                                |
// |        vert_pane               |
// |   +-----------------------+    |
// |   |    menu_frame         |    |
// |   +-----------------------+    |
// |   |   horiz_pane          |    |
// |   | +---+---------------+ |    |
// |   | |   |               | |    |
// |   | |t f| c o n t e n t | |    |
// |   | |r r|               | |    |
// |   | |e a|   f r a m e   | |    |
// |   | |e m|               | |    |
// |   | |  e|               | |    |
// |   | +---+---------------+ |    |
// |   +-----------------------+    |
// |                                |
// +--------------------------------+

And key parts of my code (inside main()):

--- cut ---
// design set-up
var vert_pane = this.gen_vert_pane();     // qx.ui.splitpane.VerticalSplitPane
var horiz_pane = this.gen_horiz_pane(); // qx.ui.splitpane.HorizontalSplitPane
var menu_frame = this.gen_menu_frame();   // qx.ui.toolbar.Toolbar
var tree_frame = this.gen_tree_frame();   // qx.ui.treevirtualTreeVirtual
var right_frame = this.gen_right_frame(); // qx.ui.layout.CanvasLayout

// add elements to the horiz_pane       
horiz_pane.addLeft(tree_frame);
horiz_pane.addRight(right_frame);
        
// add elements to vert_pane
vert_pane.addTop(menu_frame);
vert_pane.addBottom(horiz_pane);
        
// add vert_pane to the document
vert_pane.addToDocument();
--- cut ---

Then I wanted to add eventlistener for tree_frame:
--- cut ---
tree_frame.addEventListener("changeSelection", this.tree_selectionChanged);
--- cut ---

Inside tree_selectionChanged(), I check which node was selected and which 
branch this node belongs to. Based on that I am calling different functions 
that are supposed to fill right_frame with data (say, a foo() function):

And here are two problems:
calling right_frame.RemoveAll() inside tree_selectionChanged results in:
        right_frame not defined

And attempt to call foo() results with
        this.foo is not a function

I think I understand why this happens -- right_frame is private var of main(), 
I guess I'd need to make it global or access right_frame some other way.

I am obviously not following some good coding practices -- if anyone could 
point me into proper direction, I'd be grateful.

Thanks.

Adam

-- 
Adam Golebiowski

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to