Lua:Neutrino-API:ctext:en
Inhaltsverzeichnis
ctext
Erzeugt eine Textbox
ctext.new{Parameter} |
Parameter:
Parameter | Typ | Description/Beschreibung | |
parent | userdata | parent cwindow object | siehe parent windows |
x | number | x-position on screen | |
y | number | y-position on screen | |
dx | number | width of textbox | |
dy | number | height of textbox | |
text | string | text | |
mode | string | display modes | ALIGN_AUTO_WIDTH |
ALIGN_AUTO_HIGH | |||
ALIGN_SCROLL | |||
ALIGN_CENTER | |||
ALIGN_RIGHT | |||
ALIGN_TOP | |||
ALIGN_BOTTOM | |||
ALIGN_NO_AUTO_LINEBREAK | |||
DECODE_HTML | |||
font_text | number | font type for text | default: MENU |
has_shadow | string | shadow on / off | default: false (off) |
color_text | number | text color | default: MENUCONTENT_TEXT |
color_frame | number | frame color | default: MENUCONTENT_PLUS_6 |
color_body | number | background color | default: MENUCONTENT_PLUS_0 |
color_shadow | number | shadow color | default: MENUCONTENTDARK_PLUS_0 |
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:
local ct1;
local ct2;
local n = neutrino();
function neutrinoExec()
repeat
msg, data = n:GetInput(500)
-- red jey hide text
if (msg == RC['red']) then
ct2:hide();
-- grenn key show text
elseif (msg == RC['green']) then
ct2:paint();
-- keys up/down or page_up/page_down scrolling text if required,
elseif (msg == RC['up'] or msg == RC['page_up']) then
ct2:scroll{dir="up"};
elseif (msg == RC['down'] or msg == RC['page_down']) then
ct2:scroll{dir="down"};
end
-- key exit or menu for left window
until msg == RC['home'] or msg == RC['setup'];
end
local text1 = "-- Caption --";
local text2 = "Hier eine Textzeile.\n\nWeiterer Text...";
local spacer = 8;
local x = 250;
local y = 150;
local dx = 800;
local dy = 300;
local fh_title = n:FontHeight(FONT['MENU_TITLE']);
-- create and show window
local w = cwindow.new{x=x, y=y, dx=dx, dy=dy, title="Lua - CComponentsText", btnRed="Text hide",
btnGreen="Text paint"};
w:paint();
local x1 = x + spacer;
local y1 = y + w:header_height() + spacer;
local dx1 = dx - spacer*2;
local dy1 = fh_title;
-- Text1 (caption) create and show
ct1 = ctext.new{x=x1, y=y1, dx=dx1, dy=dy1, text=text1, mode="ALIGN_AUTO_WIDTH | ALIGN_CENTER",
font_text=FONT['MENU_TITLE']};
ct1:paint();
y1 = y1 + fh_title + spacer*2;
dy1 = 70;
-- Text2 create and show
ct2 = ctext.new{x=x1, y=y1, dx=dx1, dy=dy1, text=text2,
mode="ALIGN_AUTO_WIDTH | ALIGN_AUTO_HIGH | ALIGN_TOP | ALIGN_SCROLL",
font_text=FONT['MENU']};
ct2:paint();
neutrinoExec();
ct1:hide();
ct2:hide();
w:hide(); |
paint
paint a ctext object on screen
ctext.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:
ct:paint{do_save_bg="true"}; |
hide
hide ctext object
ctext.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:
ct:hide{no_restore="true"}; |
scroll
sroll within ctext object
ctext.scroll{Parameter} |
Parameter:
Parameter | Typ | Description/Beschreibung | |
scroll | string | scroll direction | Mögliche Werte: "up", "down" |
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:
ct:scroll{dir="down"}; |
setText
assign text
ctext.setText {Parameter} |
Parameter:
Parameter | Typ | Description/Beschreibung | |
text | string | text | |
mode | string | display modes | default: value on init new |
font_text | number | font type | default: value on init new |
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:setText{text="Huhu..."}; |