--OSCheckBox-- __index = OSControl type = "OSCheckBox" TextColour = colours.black DisabledTextColour = colours.lightGrey OnDisabledBackgroundColour = colours.grey OffDisabledBackgroundColour = colours.lightGrey BackgroundColour = colours.white OnBackgroundColour = colours.lime OffBackgroundColour = colours.red OnTextColour = colours.white valueChangedAction = nil state = false new = function(self, _x, _y, _title, _state, _valueChangedAction) local new = {} -- the new instance setmetatable( new, {__index = OSCheckBox} ) -- copy an instance of OSMenuItem new.width = string.len(_title)+2 new.height = 1 new.x = _x new.y = _y new.title = _title new.state = _state new.valueChangedAction = _valueChangedAction new.action = _action new.enabled = true return new end action = function(self) self.state = not self.state end Draw = function(self) local bgColour = colors.black local textColour = colours.black local check = "x" if self.state then if self.enabled then bgColour = self.OnBackgroundColour textColour = self.OnTextColour else bgColour = self.OnDisabledBackgroundColour textColour = self.DisabledTextColour end else if self.enabled then bgColour = self.OffBackgroundColour else bgColour = self.OffDisabledBackgroundColour textColour = self.DisabledTextColour end check = " " end OSDrawing.DrawCharacters(self.x,self.y, check, textColour, bgColour) OSDrawing.DrawCharacters(self.x+2,self.y, self.title, self.TextColour, self.BackgroundColour) end