Infeasible
Status Update
Comments
tf...@tftshare.ca <tf...@tftshare.ca> #2
I too would like to see this feature added as well, but make it so it randomizes the numbers every time.
an...@gmail.com <an...@gmail.com> #3
My vote would be to randomize the number locations and leave OK in the same "bottom right" location.
I'm coming here from "obsoleted" Issue 36920396 : https://code.google.com/p/android/issues/detail?id=10496
I'm coming here from "obsoleted"
ko...@gmail.com <ko...@gmail.com> #5
Unfortunately it's not possible to get the current state of a widget in UiApp. You can get the value of the listbox using as a parameter to a callback function, but it's not possible to get a listing of the items in the list. Your best option is likely what was already mentioned, use the CacheService to store a copy of the list items and clear and repopulate the listbox.
[Deleted User] <[Deleted User]> #6
Agreed!! I really need a getValue, getText and getItemCount Implementation on listbox.
[Deleted User] <[Deleted User]> #7
Why is this true? Is there a motivation not to add this? It seems like very basic functionality.
cm...@unitec.edu <cm...@unitec.edu> #8
//Add a handler to the ListBox when its value is changed
var handler = app.createServerChangeHandler('showSelectedinfo');
handler.addCallbackElement(listBox);
listBox.addChangeHandler(handler);
var infoLabel = app.createLabel('listBoxItemsValueHere').setId('info');
//This functions displays the infolabel with when ListBox value is changed
function showSelectedinfo(e){
var app = UiApp.getActiveApplication();
app.getElementById('info').setText('You selected :'+e.parameter.myList).setVisible(true)
.setStyleAttribute('color','#008000');
return app;
}
hi guys now help me to get index value please!
var handler = app.createServerChangeHandler('showSelectedinfo');
handler.addCallbackElement(listBox);
listBox.addChangeHandler(handler);
var infoLabel = app.createLabel('listBoxItemsValueHere').setId('info');
//This functions displays the infolabel with when ListBox value is changed
function showSelectedinfo(e){
var app = UiApp.getActiveApplication();
app.getElementById('info').setText('You selected :'+e.parameter.myList).setVisible(true)
.setStyleAttribute('color','#008000');
return app;
}
hi guys now help me to get index value please!
[Deleted User] <[Deleted User]> #9
can anyone tell how I iterate through the values of the listbox.
Description
According to the ListBox documentation there is no way to iterate through the list items and retrieve either name or value of an item.
However in the GWT documentation, these members exist and are obviously needed for:
- removing an item with a given value/name in the list box
- reordering list box items based on the item values or names
Look at the following case:
ListBox with items (name,uniqueId) in a UI, two buttons (create new, delete).
For the 'delete' functionality I want to be able to write this:
// This is the clickhandler function for the button 'delete'
function deleteItem(e) {
var itemId = e.parameter.listBox;
// some code to delete the item with unique Id 'itemId' in a database
// now we need to remove the ListBox item in the UI
var app = UiApp.getActiveApplication();
var listBox = app.getElementById('listBox');
for (i=1; i<listBox.getItemCount()+1; i++) {
if (listBox.getValue(i) == itemId) {
listBox.removeItem(i);
}
}
}
The GAS ListBox UI element is IMHO currently crippled. Please make it useful and implement the members that already exist in the underlying GWT ListBox!
All the best
Mario
PS:
Workarounds (however ugly):
A current workaround, however ugly, is using .clear() and re-initialize the ListBox with the stored or generated items.
There are other workarounds by using a global variable but this doesn't work if all the ListBox modifying code is in the same function (not clickhandlers).
If there are other ways to emulate the desired behaviour please let me know.