Open noamkrief opened 3 weeks ago
Perhaps your getValue
handler doesn't return something right? Or you wouldn't have "???" in the choice field.
It will be easier to help if you paste your script here!
@bsongis-frsky
local function create() return { battery_alert = false, } end
local function wakeup(widget)
end
local function paint(widget)
end
local function configure(widget) line = form.addLine("Battery Type") form.addChoiceField(line, nil, {{"Lipo", 1}, {"HV Lipo", 2}, {"Lion", 3}, {"LiFe", 4}}, function() return widget.BattType end, function(value) print(value) widget.BattType = value end) --widget.BattType_field:default(1)
end
local function read(widget) widget.BattType = storage.read ("BattType")
end
local function write(widget) storage.write("BattType" , widget.BattType)
end
local function init() system.registerWidget({key="noam", name="noam", create=create, paint=paint, configure=configure, read=read, write=write, wakeup=wakeup}) Init = false end
return {init=init}
addChoiceField always uses 3rd option as default. If there are only 2 options, you get "???" in the choice field.
It would be nice to be able to select a default item. THANKS!