Lua:Neutrino-API:cwindow:en

Aus TuxBoxWIKI
Wechseln zu: Navigation, Suche

cwindow

Create a window on scree with titlebar (header), body and buttonbar (footer)

cwindow.new{Parameter}


Parameter:

Parameter Typ Description/Beschreibung
x number x-position on screen
y number y-position on screen
dx number width of window
dy number height of window
title string caption text
icon string icon in titlebar default: "info"
has_shadow string shadow on / off default: false (off)
color_frame number frame color default: MENUCONTENT_PLUS_6
color_body number background color (relevant for body) default: MENUCONTENT_PLUS_0
color_shadow number shadow color default: MENUCONTENTDARK_PLUS_0
btnRed string red button in buttonbar
btnGreen string green button in buttonbar
btnYellow string yellow button in buttonbar
btnBlue string blue button in buttonbar
show_header string Sets whether to display a Header default: true (On)
show_footer string Sets whether to display a Footer default: true (On)
en: Parameters with default-values are optional. If not needed, no definition is required. In case of missing parameter, default value is used.

de: Parameter mit Default-Wert sind optional. dh. sie müssen nicht angegeben werden. Falls der Parameter fehlt, wird automatisch dieser Wert angenommen.


Example:

-- window with title and buttonbar
-- pressed red key will print a text in log output
-- extit key closes window
local n = neutrino()
local w = cwindow.new{x=50, y=50, dx=400, dy=200, name="Lua Test", icon="info", btnRed="Knopp rot"}
w:paint()

repeat
	msg, data = n:GetInput(500)
	if (msg == RC['red']) then
		print("Text 1")
	end
until msg == RC['home']
w:hide()


Beispiel 1


Example:

-- Window without header and footer
local w = cwindow.new{x=50, y=50, dx=400, dy=200, name="Lua Test", icon="info", show_header=false, show_footer=false}


paint

Paints a window on screen with all contents at once

cwindow.paint{Parameter}


Parameter:

Parameter Typ Description/Beschreibung
do_save_bg boolean save background bevore paint object, if true then usually background can be restored default: true
en: Parameters with default-values are optional. If not needed, no definition is required. In case of missing parameter, default value is used.

de: Parameter mit Default-Wert sind optional. dh. sie müssen nicht angegeben werden. Falls der Parameter fehlt, wird automatisch dieser Wert angenommen.


Example:

w:paint{do_save_bg=true};


hide

Removes object from screen and restore background

cwindow.hide{Parameter}


Parameter:

Parameter Typ Description/Beschreibung
no_restore boolean Specifies whether saved screen data can't be deleted (if available)) default: false
en: Parameters with default-values are optional. If not needed, no definition is required. In case of missing parameter, default value is used.

de: Parameter mit Default-Wert sind optional. dh. sie müssen nicht angegeben werden. Falls der Parameter fehlt, wird automatisch dieser Wert angenommen.


Example:

w:hide{no_restore=true};


setCaption

Assign caption text

cwindow.setCaption {Parameter}


Parameter:

Parameter Typ Description/Beschreibung
title string caption
en: Parameters with default-values are optional. If not needed, no definition is required. In case of missing parameter, default value is used.

de: Parameter mit Default-Wert sind optional. dh. sie müssen nicht angegeben werden. Falls der Parameter fehlt, wird automatisch dieser Wert angenommen.


Example:

w:setCaption{title="Hallo..."};


setBodyImage

API-Version >= 1.87

Set a scaled background image to window body

cwindow.setBodyImage {Parameter}


Parameter:

Parameter Typ Description/Beschreibung
image_path string path to image file (jpg, png)
en: Parameters with default-values are optional. If not needed, no definition is required. In case of missing parameter, default value is used.

de: Parameter mit Default-Wert sind optional. dh. sie müssen nicht angegeben werden. Falls der Parameter fehlt, wird automatisch dieser Wert angenommen.


Example:

w:setBodyImage{image_path="/share/tuxbox/neutrino/icons/start.jpg"};


paintHeader

Repaint titlebar

cwindow.paintHeader {}


Example:

w:paintHeader();


headerHeight

Returns height of header

cwindow.headerHeight{}


Example:

local hh = w:headerHeight();


footerHeight

Returns height of buttonbar

cwindow.footerHeight{}


Example:

local fh = w:footerHeight();