A structured access is only possible when you create it as a structure. You
are creating the buttons as vars, not as part of the structure. After you
create the button you are setting it's parent using the add method, but you
are not changing it's scope. It is a var owned by "this". And since it's a
var, you don't have any external access to it directly, but you can walk the
getChildren tree and get to it because of the parent/child relationship. If
you want to access the button the way that you have shown, then create it in
the same tree structure.

eg:

this.toolbar1 = new qx.ui.toolbar();
this.add(this.toolbar1);
this.toolbar1.part = new qx.ui.toolbar.Part();
this.toolbar1.add(this.toolbar1.part);

If you create it in a structure, then you can access it as a structure.
Simply adding an object to another object does not add it to the objects
structure, it just changes it's parent.

Jim


On Sun, Mar 7, 2010 at 2:02 AM, Stefan Meyer <[email protected]> wrote:

> but a direct call isnt possible? This isnt very readabel but thats will
> work
>
> this.toolbar2.getChildren()[0].getChildren()[1].setEnabled(true)
>
> isnt their any structr access possible ? here i use the element names?
> > Hi,
> >
> > This command will call a function reference/variable with the name part
> > (this.toolbar1.part).
> > But the toolbar object hasn't got this item.
> >
> > An easy way is to save the button as a private variable in your class
> > and call them with the this-operator directly.
> >
> > this.__newButton = new qx.ui.toolbar.Button(...);
> > ...
> > this.__newButton.setEnabled(true);
> >
> > Good night.
> >
> > Am 07.03.2010 00:53, schrieb [email protected]:
> >
> >> Hello i create  some toolbars like this
> >>
> >>              getToolbar1 : function() {
> >>                  // create the toolbar
> >>                    this.toolbar1 = new qx.ui.toolbar.ToolBar(new
> >> qx.ui.layout.Dock()).set({
> >>                              decorator        : "main",
> >>                              allowStretchX     : true,
> >>                              allowStretchY     : true
> >>                              });
> >>                  // create and add Part 1 to the toolbar
> >>                  var part1 = new qx.ui.toolbar.Part();
> >>                  var newButton = new qx.ui.toolbar.Button("Neu",
> >> "jobs/icon/16/actions/document-new.png");
> >>                  var editButton = new qx.ui.toolbar.Button("Bearbeiten",
> >> "jobs/icon/16/actions/edit-paste.png");
> >>                  var deleteButton = new
> qx.ui.toolbar.Button("Entfernen",
> >> "jobs/icon/16/actions/edit-delete.png");
> >>
> >>                  newButton.addListener("execute",  function(e) {
> >>                      alert("Neu");
> >>                      },this);
> >>                  editButton.addListener("execute",  function(e) {
> >>                      alert("Bearbeiten");
> >>                      },this);
> >>                  editButton.setEnabled(false);
> >>                  deleteButton.addListener("execute",  function(e) {
> >>                      alert("Entfernen");
> >>                      },this);
> >>                  deleteButton.setEnabled(false);
> >>
> >>
> >>
> >>                  // Export
> >>                  var exportMenu = new qx.ui.menu.Menu();
> >>                  exportMenu.setEnabled(false);
> >>                  var button = Array();
> >>                  button[0] = new qx.ui.menu.Button("PDF",
> >> "jobs/icon/16/actions/home.png");
> >>                  button[0].addListener("execute",  function(e) {
> >>                      alert("Export CSV");
> >>                      },this);
> >>                  exportMenu.add(button[0]);
> >>                  button[1] = new qx.ui.menu.Button("CSV",
> >> "jobs/icon/16/actions/home.png");
> >>                  button[1].addListener("execute",  function(e) {
> >>                      alert("Export CSV");
> >>                      },this);
> >>                  exportMenu.add(button[1]);
> >>                  var exportButton = new
> >>
> qx.ui.toolbar.MenuButton("Export","jobs/icon/16/actions/home.png",exportMenu);
> >>
> >>
> >>                  part1.add(newButton);
> >>                  part1.add(editButton);
> >>                  part1.add(deleteButton);
> >>                  part1.add(new qx.ui.toolbar.Separator());
> >>                  part1.add(exportButton);
> >>                  this.toolbar1.add(part1);
> >>
> >>                  return this.toolbar1;
> >>                  },
> >>
> >>
> >> now i want to access the  different buttons and enable them like this
> >>
> >>              this.table1.addListener("cellClick", function(e) {
> >>
> >>                      var row             = e.getRow()
> >>                      var column     = e.getColumn()
> >>                      alert("ID: "+this.tableModel1.getValue(0, row));
> >>
> >>
>  alert(this.toolbar1.part.newButton.setEnabled(true));
> >>
>  alert(this.toolbar1.part.editButton.setEnabled(true));
> >>
>  alert(this.toolbar1.part.deleteButton.setEnabled(true));
> >>
>  alert(this.toolbar1.part.exportButton.setEnabled(true));
> >>
> >>
> >>                      }, this);
> >>
> >>
> >> but i alwys get errors. the object is  since the
> >> alert(this.toolbar1.part);
> >>
> >> undefined but i add  the part1 and some buttons into the part1 in the
> >> function above:( WHy i cant access them?
> >>
> >>
> ------------------------------------------------------------------------------
> >> Download Intel&#174; Parallel Studio Eval
> >> Try the new software tools for yourself. Speed compiling, find bugs
> >> proactively, and fine-tune applications for parallel performance.
> >> See why Intel Parallel Studio got high marks during beta.
> >> http://p.sf.net/sfu/intel-sw-dev
> >> _______________________________________________
> >> qooxdoo-devel mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >>
> >>
> >
> >
> >
> ------------------------------------------------------------------------------
> > Download Intel&#174; Parallel Studio Eval
> > Try the new software tools for yourself. Speed compiling, find bugs
> > proactively, and fine-tune applications for parallel performance.
> > See why Intel Parallel Studio got high marks during beta.
> > http://p.sf.net/sfu/intel-sw-dev
> > _______________________________________________
> > qooxdoo-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >
> >
>
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to