GuiDeleteTab: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 18: Line 18:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function deleteTabOnClick ()
function deleteTabOnClick ()
if ( getKeyState ( "lctrl" ) == true ) then    -- if the user is holding down left control
if ( getKeyState ( "lctrl" ) == true ) and ( guiGetType ( source ) == "tab" ) then    -- if the user is holding down left control
guiDeleteTab ( source )                -- delete the tab. No need to check if it was actually a tab that was clicked, as this function doesn't work on other controls anyway
guiDeleteTab ( source )                -- delete the tab. No need to check if it was actually a tab that was clicked, as this function doesn't work on other controls anyway
end
end

Revision as of 12:29, 22 October 2007

This function deletes a tab from a tab panel.

Syntax

bool guiDeleteTab ( element tabToDelete )

Required Arguments

  • tabToDelete: This is an element representing the tab that you want to delete.

Returns

Returns true the tab was successfully deleted, false otherwise.

Example

This example removes a tab panel if a user LeftCtrl+Clicks a tab panel.

function deleteTabOnClick ()
	if ( getKeyState ( "lctrl" ) == true ) and ( guiGetType ( source ) == "tab" ) then    -- if the user is holding down left control
		guiDeleteTab ( source )                -- delete the tab. No need to check if it was actually a tab that was clicked, as this function doesn't work on other controls anyway
	end
end
addEventHandler ( "onClientGUIClick", getRootElement(), deleteTabOnClick  )    -- add an event handler for clicks

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