addButton.js

function randomClicked()
{
  QMessageBox.information(mywindow, qsTr("Something Happened"),
                          qsTr("The Random button was clicked."));
}

var btnDelete = mywindow.findChild("_delete");
var layout    = toolbox.widgetGetLayout(btnDelete);
var newbutton = toolbox.createWidget("QPushButton", mywindow, "_scriptButton");

newbutton.text = qsTr("Random");
toolbox.layoutBoxInsertWidget(layout, -1, newbutton, 0, 0);

newbutton.clicked.connect(randomClicked);

Generated on Tue Apr 20 12:02:24 2010 xTuple ERP Programmer Reference, Version 3.5.0 doxygen 1.6.1