<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Anchor</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Anchor"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Anchor"/>
	<updated>2026-04-29T04:03:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsCreateLabel&amp;diff=52288</id>
		<title>DgsCreateLabel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsCreateLabel&amp;diff=52288"/>
		<updated>2017-09-14T07:30:57Z</updated>

		<summary type="html">&lt;p&gt;Anchor: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
[[Image:gui-label.png|frame|Example GUI label.]]&lt;br /&gt;
&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td valign=top height=100&amp;gt;&lt;br /&gt;
This function is for creating a new DGS label.  A label is simply a piece of text that cannot be edited by the user. If you would like to have a bigger text you can either change its size with property &amp;quot;textsize&amp;quot;( dgsDxGUISetProperty(label,&amp;quot;textsize&amp;quot;,{scale_x,scale_y}) ) or change its font.&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element dgsDxCreateLabel ( float x, float y, float width, float height, string text, bool relative, [element parent = nil, int textcolor = 0xFFFFFFFF, float scale_x = 1, float scale_y = 1, float shadowOffset_x = nil, float shadowOffset_y = nil, int shadowColor = nil, string horizontalAlign = &amp;quot;left&amp;quot;, string verticalAlign = &amp;quot;top&amp;quot;] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''x:''' A float of the 2D x position of the DGS label on a player's screen.  This is affected by the ''relative'' argument.&lt;br /&gt;
*'''y:''' A float of the 2D y position of the DGS label on a player's screen. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''width:''' A float of the width of the GUI label. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''height:''' A float of the height of the GUI label. This is affected by the ''relative'' argument.&lt;br /&gt;
*'''text:''' A string of the text that will be displayed by the label.&lt;br /&gt;
*'''relative:''' This is whether sizes and positioning are relative.  If this is ''true'', then all x,y,width,height floats must be between 0 and 1, representing sizes relative to the parent.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''parent:''' This is the parent that the gui label is attached to.  If the ''relative'' argument is true, sizes and positioning will be made relative to this parent. If the ''relative'' argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning.&lt;br /&gt;
*'''textcolor:''' An int of the color of the text color.&lt;br /&gt;
*'''scale_x:''' A float of the width of the text scale.&lt;br /&gt;
*'''scale_y:''' A float of the height of the text scale.&lt;br /&gt;
*'''shadowOffset_x:''' A float of the 2D x position offset of the shadow text. &lt;br /&gt;
*'''shadowOffset_y:''' A float of the 2D y position offset of the shadow text.&lt;br /&gt;
*'''shadowColor:''' An int of the color of the shadow text.&lt;br /&gt;
*'''horizontalAlign:''' A string of the horizontal alignment of the label.&lt;br /&gt;
**&amp;quot;left&amp;quot;&lt;br /&gt;
**&amp;quot;center&amp;quot;&lt;br /&gt;
**&amp;quot;right&amp;quot;&lt;br /&gt;
*'''verticalAlign:''' A string of the vertical alignment of the label.&lt;br /&gt;
**&amp;quot;top&amp;quot;&lt;br /&gt;
**&amp;quot;center&amp;quot;&lt;br /&gt;
**&amp;quot;bottom&amp;quot;&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[DGS_widgets|element]] of the created label if it was successfully created, false otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:''' This example creates a information window and adds two tabs to a &amp;quot;tabPanel&amp;quot; tabpanel, and adds some dgs labels to each tab.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
DGS = exports.dgs&lt;br /&gt;
local myWindow = DGS:dgsDxCreateWindow ( 0, 0, 0.5, 0.4, &amp;quot;Information&amp;quot;, true )--create a window which has &amp;quot;Information&amp;quot; in the title bar.&lt;br /&gt;
local tabPanel = DGS:dgsDxCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow ) --create a tab panel which fills the whole window&lt;br /&gt;
local tabMap = DGS:dgsDxCreateTab( &amp;quot;Map Information&amp;quot;, tabPanel ) -- create a tab named &amp;quot;Map Information&amp;quot; on 'tabPanel'&lt;br /&gt;
local tabHelp = DGS:dgsDxCreateTab( &amp;quot;Help&amp;quot;, tabPanel ) -- create another tab named &amp;quot;Help&amp;quot; on 'tabPanel'&lt;br /&gt;
&lt;br /&gt;
-- adds a label (text) to each tab&lt;br /&gt;
DGS:dgsDxCreateLabel(0.02,0.04,0.94,0.2,&amp;quot;This is information about the current map&amp;quot;,true,tabMap)&lt;br /&gt;
DGS:dgsDxCreateLabel(0.02,0.04,0.94,0.92,&amp;quot;This is help text.&amp;quot;,true,tabHelp)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example creates a label.  When an element is clicked, the label displays in the position of the element telling you what kind of element you have clicked.  It hides after 5 seconds.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
DGS = exports.dgs&lt;br /&gt;
local myLabel = DGS:dgsDxCreateLabel  ( 0, 0, 1, 1, &amp;quot;&amp;quot;, true )&lt;br /&gt;
&lt;br /&gt;
function addLabelOnClick ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement )&lt;br /&gt;
        --if an element was clicked on screen&lt;br /&gt;
        if ( clickedElement ) then&lt;br /&gt;
                --retreive the element type&lt;br /&gt;
                local elementType = getElementType ( clickedElement )&lt;br /&gt;
                --change the label text to that element type&lt;br /&gt;
                DGS:dgsDxGUISetText ( myLabel, elementType )&lt;br /&gt;
                --and place it in the position of where the element is&lt;br /&gt;
                DGS:dgsSetPosition ( myLabel, absoluteX, absoluteY, false )&lt;br /&gt;
                --hide the text by passing an empty string 5 seconds later&lt;br /&gt;
                setTimer ( DGS:dgsDxGUISetText, 5000, 1, myLabel, &amp;quot;&amp;quot; )&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientClick&amp;quot;, getRootElement(), addLabelOnClick )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{DGSFUNCTIONS}}&lt;/div&gt;</summary>
		<author><name>Anchor</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DgsEditSetMaxLength&amp;diff=52287</id>
		<title>DgsEditSetMaxLength</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DgsEditSetMaxLength&amp;diff=52287"/>
		<updated>2017-09-14T07:19:09Z</updated>

		<summary type="html">&lt;p&gt;Anchor: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function sets the maximum text length that can be typed into an edit box.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool dgsDxEditSetMaxLength ( element Edit, int length )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
&lt;br /&gt;
*'''theElement:''' The dgs-dxedit  to be changed.&lt;br /&gt;
*'''length:''' An integer indicating the maximum number of characters that can be typed into the box.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the max length was set successfully, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
DGS = exports.dgs&lt;br /&gt;
This example creates an edit box with a limit on text length, alongside an &amp;quot;Output!&amp;quot; button.  When the button is clicked, it will output the message in the edit box into the Chat Box.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create our button&lt;br /&gt;
button = DGS:dgsDxCreateButton( 0.7, 0.1, 0.2, 0.1, &amp;quot;Output!&amp;quot;, true )&lt;br /&gt;
-- create an edit box and define it as &amp;quot;editBox&amp;quot;.&lt;br /&gt;
editBox = DGS:dgsDxCreateEdit( 0.3, 0.1, 0.4, 0.1, &amp;quot;Type your message here!&amp;quot;, true )&lt;br /&gt;
-- set a maximum text length of 128 characters&lt;br /&gt;
DGS:dgsDxEditSetMaxLength ( editBox, 128 )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{DGSFUNCTIONS}}&lt;/div&gt;</summary>
		<author><name>Anchor</name></author>
	</entry>
</feed>