SetBindKeyWindowShow: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(SAZA)
Line 1: Line 1:
<pageclass class="#228B22" subcaption="Useful Function"></pageclass>
TGRBH
<lowercasetitle/>
__NOTOC__
{{Useful Function}}
This function will hide window automatically and set BindKey to show it.
<br /><br />
 
==Syntax==
<syntaxhighlight lang="lua">
bool setBindKeyWindowShow ( element Window, string key )
</syntaxhighlight>
 
===Required Arguments===
* '''Window''': Window you want to edit it.
* '''key''': Key you want to enable it.
<br /><br />
 
==Code==
<section name="Function source" class="client" show="true">
<syntaxhighlight lang="lua">
setBindKeyWindowShow = function ( guiWindow, key )
if guiWindow and key then
if getElementType ( guiWindow ) == "gui-window" then
guiSetVisible ( guiWindow, false );
local setBindKey_ = function ( key )
guiSetVisible ( guiWindow, not guiGetVisible ( guiWindow ) );
showCursor ( guiGetVisible ( guiWindow ) );
end
return bindKey ( key, "down", setBindKey_ );
else
return false;
end
else
return false;
end
end
</syntaxhighlight>
</section>
<br /><br />
 
==Example==
<section name="Client-side example" class="client" show="true">
This Example will hide window and showing it by BindKey.
<syntaxhighlight lang="lua">
Window = guiCreateWindow ( 40, 40, 200, 200, "Test", false ) -- Create window.
setBindKeyWindowShow ( Window, "f2" ) -- Enable function on it.
</syntaxhighlight>
</section>
<br /><br />
 
* This Function Has Created By '''3NAD'''.
 
==See Also==
{{Useful_Functions}}
 
[[Category:Useful Functions]]

Revision as of 12:16, 5 February 2015

TGRBH