class MainMenu extends Toybox.Lang.Object {
...
function start() {
...
Ui.pushView(new NumberChooser(...), new NumberChooserDelegate( method( :updateAttnValue ), null ), Ui.SLIDE_IMMEDIATE);
...
}
function updateAttnValue(values) {
// do something with values from picker
}
...
}
class NumberChooserDelegate extends Ui.PickerDelegate {
var acceptCB = null;
var cancelCB = null;
function initialize(accCb, cncCb) {
acceptCB = accCb;
cancelCB = cncCb;
}
function onCancel() {
if (cancelCB != null) {
cancelCB.invoke();
}
Ui.popView(Ui.SLIDE_IMMEDIATE);
}
function onAccept(values) {
if (acceptCB != null) {
acceptCB.invoke(values);
}
Ui.popView(Ui.SLIDE_IMMEDIATE);
}
}
This works fine in simulator, but I'm getting constant "Circular reference" errors in CIQ_LOG.txt on ForeRunner 230.
Problem seems to appear only after invocation of callback method meaning if I start picker and exit via Back key, then I don't get such errors after application finishes.
Please, someone, shed the light on this one.
Thanks in advance.