ComputerCraft Archive

DropMenuItem

computer utility kepler155c github

Description

ComputerCraft OS

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/modules/opus/ui/components/DropMenuItem.lua dropmenuitem
Archive:wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-modules-opus-ui-components-dropmenuitem dropmenuitem
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-modules-opus-ui-components-dropmenuitem DropMenuItem

Usage

Run: DropMenuItem

Tags

none

Source

View Original Source

Code Preview

local class = require('opus.class')
local UI    = require('opus.ui')

UI.DropMenuItem = class(UI.Button)
UI.DropMenuItem.defaults = {
	UIElement = 'DropMenuItem',
	textColor = 'black',
	backgroundColor = 'white',
	textFocusColor = 'white',
	textInactiveColor = 'lightGray',
	backgroundFocusColor = 'lightGray',
}
function UI.DropMenuItem:eventHandler(event)
	if event.type == 'button_activate' then
		self.parent:disable()
	end
	return UI.Button.eventHandler(self, event)
end