Basic ListDialog with commas

36 views
Skip to first unread message

Steve Garman

unread,
Feb 12, 2020, 4:29:28 AM2/12/20
to DroidScript
It does not appear possible to escape a comma in the text of a ListDialog.

If you are looking for something like a basic ListDialog, which allows you to change the delimiter from a comma, you could try something like this.


function OnStart()
{
var data = "Hi, Joe%how are you?";
ldlg = myListDialog("", "My Title", ldlg_OnTouch);
//set list with delimiter
ldlg.SetList(data, "%");
ldlg.Show();
}

function ldlg_OnTouch(item, body, icon, index)
{
app.ShowPopup(item);
this.Dismiss();
}

function myListDialog(list, title, callback)
{
var lv = app.CreateDialog(title, "noXcancel");
var lay = app.CreateLayout("Linear", "");
var lst = app.CreateList(list);
lst.Dismiss = function(){lv.Dismiss()};
lay.AddChild(lst);
lv.AddLayout(lay);
if(callback) lst.SetOnTouch(callback);
else lst.SetOnTouch(function(){lv.Dismiss()});

lv.SetList = function(list, delim){lst.SetList(list, delim)};
return lv
}

Kallikratidas

unread,
Feb 12, 2020, 9:11:47 AM2/12/20
to DroidScript
Basically, I don't think that this is an important problem (the use of the Selim in the ListDialog object), because it is not an object to use in more commercial cases.
Reasons:

*It can't be much customized.
*It has many scaling problems.
*IT BRAKES THE GAME MODE IN MOST PHONES, like all app Dialogs, Alerts And ListView do.

But yes, it would be a great solution to create custom objects anyway instead of using the test object, because all these are test objects for me as they can not lead the app Layout. They have their own layouts and it's not a good idea to use them when creating an app, but making an algorithm or any kind of test.

Droid On!

Reply all
Reply to author
Forward
0 new messages