This looks like a scope issue. You are declaring QxCanvasLayout1 inside a function meaning that it has local scope. You are then trying to reference that local object from inside another function (each QxRequest creates a new function to work in). What I do is to not eval the code inside the QxRequest code. I create a function that returns the code back to the main function then eval it there. That way newly created objects are created at the top level and everything will have access to it.

Jim

On 5/2/06, Ralf Wenske <[EMAIL PROTECTED]> wrote:
Could someone please help me fill this gap in understanding:


I have successfully created a page with a bunch of widgets.
Amongst them :

   var loFrame = new QxCanvasLayout;
   loFrame.setBackgroundColor (new QxColor([255,255,153]));
   loFrame.setLeft(193);
   loFrame.setRight(0);
   loFrame.setTop(70);
   loFrame.setBottom(41);
   d.add(loFrame);


Now in reaction to a menu-execute event the browser sends a QxRequest
(no special MIME setting) and receives the following:

   var QxCanvasLayout1 = new QxCanvasLayout;
   QxCanvasLayout1.setBackgroundColor(new QxColor([204,255,0]));
   QxCanvasLayout1.setLeft(10);
   QxCanvasLayout1.setRight (0);
   QxCanvasLayout1.setTop(0);
   QxCanvasLayout1.setBottom(0);
   QxCanvasLayout1.setBorder(new QxBorderObject(2, "ridge"))
   loFrame.add(QxCanvasLayout1);


processing of the received code happens here:

       req.addEventListener("completed", function(e){;
         var cmd = e.getData().getContent();
         eval(cmd);
         } );

This all seems to work well (there is also a QxLabel inside
QxCanvaslLayout1 and it also shows in the browser).

A further QxRequest receives and processes the following:

   loFrame.setBackgroundColor(new QxColor([204,255,153]));
   QxCanvasLayout1.setBackgroundColor (new QxColor([153,255,0]));

in the browser the backgroundcolor of loFrame changes nicely -
however the debugger says:

   [EMAIL PROTECTED]:Failed to execute "_dispatchEvent()":
   Could not dispatch event of type "completed":
   ReferenceError: QxCanvasLayout1 is not defined(error)



Now my question:

Can I find a reference to 'QxCanvasLayout1' (how)?
I do not seem to understand fully the scope of things:

the sourcecode "var loFrame ..." is visible when I look at the browser
source
the sourcecode "var QxCanvasLayout1 ..." obviously is not visible as it
was sent in from the server via QxRequest and processed inside an eval().
However when it was 'eval()'d the command
   loFrame.add(QxCanvasLayout1)
must have created some persistent (child-)reference to the object (which
is rendered ok).

I am thinking that there might be some d....FindWidget() or similiar -
if that is documented I must have missed it when searching.

Or am I doing something fundametally wrong? (Which I very well might as
I am not completely on top of things here).


Can someone please shed some light on what is happening (perhaps in
simple words - I only understand objects in a compiler environment)
or
perhaps point me to a demo/test example that somehow demonstrates so I
can understand better what is going on 'down in the dungeons' between
qooxdoo and _javascript_?


Thanks

Ralf Wenske



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Qooxdoo-devel mailing list
Qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to