dspBacklog.js
/*
* This file is part of the xTuple ERP application suite,
* and is Copyright (c) 1999-2019 by OpenMFG LLC, d/b/a xTuple. It
* is licensed to you under the xTuple End-User License Agreement ("the
* EULA"), the full text of which is available at www.xtuple.com/EULA.
* While the EULA gives you access to source code and encourages your
* involvement in the development process, this Package is not free
* software. By using this software, you agree to be bound by the
* terms of the EULA.
*/
/* This example shows how to add a button, position it in an existing
window, and do something interesting when a user clicks on it.
In this case, the 'something interesting' is expand or collapse
indented data in a Display window. These are the application windows
usually found under xTuple ERP's Report submenus.
*/
// The Display class in the C++ app has a method to get its XTreeWidget
var _list = mywindow.list();
/* The sExpand() and sCollapse() functions allow us to do more than
just expand and collapse the lists if we want to.
*/
function sExpand()
{
_list.expandAll();
}
function sCollapse()
{
_list.collapseAll();
}
// Create two QPushButton objects that belong to the window.
var _expand = toolbox.createWidget("QPushButton", mywindow, "_expand");
var _collapse = toolbox.createWidget("QPushButton", mywindow, "_collapse");
/* Set the text of those buttons.
qsTr allows the text to be translated while the & creates a hotkey
that can be used to click the button from the keyboard.
*/
_expand.text = qsTr("E&xpand All");
_collapse.text = qsTr("C&ollapse All");
// To position the new buttons, first find the layout container that holds _list
var _layout = toolbox.widgetGetLayout(_list);
/* _layout happens to be a QGridLayout and _list is in row 2, column 0. To put
_expand and _collapse under _list, we place them in rows 3 and 4, col 0.
*/
_layout.addWidget(_expand, 3, 0);
_layout.addWidget(_collapse, 4, 0);
_expand.clicked.connect(sExpand);
_collapse.clicked.connect(sCollapse);

Generated on Fri Apr 9 2021 xTuple ERP Programmer Reference, Version 6.0.0 doxygen 1.8.17