VGUI Label: Difference between revisions
| mNo edit summary | mNo edit summary | ||
| Line 1: | Line 1: | ||
| {{stub}} | {{stub}} | ||
| TextImage. | Uses font "Default" if font is invalid. | ||
|   //  | |||
| Text uses the control TextImage to render. | |||
| -- | |||
| "labelText" text | |||
| defaults NULL = "" | |||
| may be a localized string if starts with # | |||
| ex. "labelText" "#Title" | |||
| If it contains an & the next character and the next only will be considered as a hotkey. If the next character is not usable it will continue parsing starting on the key AFTER the next. So, if it contains two consecutive &, it will fail, both will be disregarded and a third & would be the one that starts a new key lookup. The hotkey has to be alphanumeric. | |||
|  ex. | |||
|  "labelText" "&a", a is hotkey | |||
|  "labelText" "&.a", no hotkey | |||
|  "labelText" "&.&a", a is hotkey | |||
|  "labelText" "&a&b", a is hotkey | |||
|  "labelText" "&&a", no hotkey | |||
|  "labelText" "&&&a&&b&c", a is hotkey | |||
| If the text is regular text it will lookup using isalnum() if it is localized (started with #) it will use iswalnum(). | |||
| Hotkeys are automatically lowercased. They fire OnHotkeyPressed(). | |||
| may be a localized variable if between '%'s | |||
| ex. "labelText" "%localize_me%" | |||
| will do: | |||
|   localize()->AddString( "var_%localize_me%", L"%localize_me%", "" ); | |||
|  Label->SetText( "#var_%localize_me%" ); | |||
| -- | |||
| "textAlignment" text | |||
| default "" = -1 | |||
| values: | |||
| "north-west" | |||
| "north" | |||
| "north-east" | |||
| "west" | |||
| "center" | |||
| "east" | |||
| "south-west" | |||
| "south" | |||
| "south-east" | |||
| -- | |||
| "associate" controlname | |||
| associated control default "" | |||
| -- | |||
| "dulltext" 0/1 | |||
| defaults 0, if 1 sets colorstate CS_DULLTEXT | |||
| if 0: | |||
| "brighttext" 0/1 | |||
| defaults 1, if 1 sets colorstate CS_BRIGHTTEXT | |||
| if 0: | |||
| sets colorstate CS_NORMAL | |||
| -- | |||
| "font" script fontname | |||
| defaults "" = "Default" | |||
| -- | |||
| "wrap" 0/1 | |||
| text wrap  | |||
| [[Category::Vgui_Controls]] | [[Category::Vgui_Controls]] | ||
Revision as of 12:25, 4 January 2007
Uses font "Default" if font is invalid.
Text uses the control TextImage to render.
--
"labelText" text
defaults NULL = ""
may be a localized string if starts with # ex. "labelText" "#Title"
If it contains an & the next character and the next only will be considered as a hotkey. If the next character is not usable it will continue parsing starting on the key AFTER the next. So, if it contains two consecutive &, it will fail, both will be disregarded and a third & would be the one that starts a new key lookup. The hotkey has to be alphanumeric.
ex. "labelText" "&a", a is hotkey "labelText" "&.a", no hotkey "labelText" "&.&a", a is hotkey "labelText" "&a&b", a is hotkey "labelText" "&&a", no hotkey "labelText" "&&&a&&b&c", a is hotkey
If the text is regular text it will lookup using isalnum() if it is localized (started with #) it will use iswalnum().
Hotkeys are automatically lowercased. They fire OnHotkeyPressed().
may be a localized variable if between '%'s ex. "labelText" "%localize_me%" will do:
localize()->AddString( "var_%localize_me%", L"%localize_me%", "" ); Label->SetText( "#var_%localize_me%" );
--
"textAlignment" text default "" = -1
values: "north-west" "north" "north-east" "west" "center" "east" "south-west" "south" "south-east"
--
"associate" controlname
associated control default ""
--
"dulltext" 0/1
defaults 0, if 1 sets colorstate CS_DULLTEXT
if 0:
"brighttext" 0/1
defaults 1, if 1 sets colorstate CS_BRIGHTTEXT
if 0:
sets colorstate CS_NORMAL
--
"font" script fontname defaults "" = "Default"
--
"wrap" 0/1
text wrap
[[Category::Vgui_Controls]]