diff --git a/sys/apis/ui.lua b/sys/apis/ui.lua index 666ddac..1813f40 100644 --- a/sys/apis/ui.lua +++ b/sys/apis/ui.lua @@ -3069,12 +3069,18 @@ UI.Checkbox.defaults = { backgroundColor = colors.black, backgroundFocusColor = colors.lightGray, height = 1, - width = 3, accelerators = { space = 'checkbox_toggle', mouse_click = 'checkbox_toggle', } } +function UI.Checkbox:setParent() + if not self.width and not self.ex then + self.width = (self.label and #self.label or 0) + 3 + end + UI.Window.setParent(self) +end + function UI.Checkbox:draw() local bg = self.backgroundColor if self.focused then @@ -3084,10 +3090,15 @@ function UI.Checkbox:draw() self.value = nil -- TODO: fix form end local text = string.format('[%s]', not self.value and ' ' or self.checkedIndicator) - self:write(1, 1, text, bg) - self:write(1, 1, self.leftMarker, self.backgroundColor, self.textColor) - self:write(2, 1, not self.value and ' ' or self.checkedIndicator, bg) - self:write(3, 1, self.rightMarker, self.backgroundColor, self.textColor) + local x = 1 + if self.label then + self:write(1, 1, self.label) + x = #self.label + 2 + end + self:write(x, 1, text, bg) + self:write(x, 1, self.leftMarker, self.backgroundColor, self.textColor) + self:write(x + 1, 1, not self.value and ' ' or self.checkedIndicator, bg) + self:write(x + 2, 1, self.rightMarker, self.backgroundColor, self.textColor) end function UI.Checkbox:focus() diff --git a/sys/autorun/gpshost.lua b/sys/autorun/gpshost.lua deleted file mode 100644 index 188d009..0000000 --- a/sys/autorun/gpshost.lua +++ /dev/null @@ -1,19 +0,0 @@ -if _G.device.wireless_modem then - - _G.requireInjector(_ENV) - local Config = require('config') - - local kernel = _G.kernel - - local config = { } - Config.load('gps', config) - - if config.host and type(config.host) == 'table' then - kernel.run({ - title = 'GPS Daemon', - hidden = true, - path = '/rom/programs/gps', - args = { 'host', config.host.x, config.host.y, config.host.z }, - }) - end -end