GuiGetFont: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: {{Client function}} __NOTOC__ <!-- Describe in plain english what this function does. Don't go into details, just give an overview --> This function is used to get the current font that is...)
 
m (Перенаправление)
 
(5 intermediate revisions by 5 users not shown)
Line 7: Line 7:
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string guiGetFont ( element guiElement )
string, element guiGetFont ( element guiElement )
</syntaxhighlight>  
</syntaxhighlight>
{{OOP||[[GUI widgets|GuiElement]]:getFont|font|guiSetFont}}


===Required Arguments===  
===Required Arguments===  
Line 16: Line 17:
===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns a string containing the element's current font, or false if the gui element passed to the function is invalid.
*'''string''' A string containing the name of the element's current font, or false if the gui element passed to the function is invalid.
*'''element ''' The custom [[GUI font]] that is used, or nil otherwise


==Example==  
==Example==  
Line 33: Line 35:
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{GUI_functions}}
{{GUI_functions}}
{{GUI_events}}
[[en:guiGetFont]]
[[ru:guiGetFont]]
[[pl:guiGetFont]]

Latest revision as of 15:50, 17 April 2021

This function is used to get the current font that is used to draw text in GUI elements.

Syntax

string, element guiGetFont ( element guiElement )

OOP Syntax Help! I don't understand this!

Method: GuiElement:getFont(...)
Variable: .font
Counterpart: guiSetFont


Required Arguments

  • guiElement: element you wish to get the font of.

Returns

  • string A string containing the name of the element's current font, or false if the gui element passed to the function is invalid.
  • element The custom GUI font that is used, or nil otherwise

Example

This example sets and gets the font of a pre-made gui element and outputs it to chat box.

-- We create a dummy gui label to get text of
local dummyGUIElement = guiCreateLabel ( 0.45, 0.48, 0.10, 0.04, "Hello world", true )
guiSetFont ( dummyGUIElement, "sa-gothic" )
-- Output the font of the label to chat box
outputChatBox ( "Font used in the GUI label: " .. guiGetFont ( dummyGuiElement ) )

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows

Input

GUI