GuiGridListIsSortingEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
bool guiGridListIsSortingEnabled ( element guiGridlist )
bool guiGridListIsSortingEnabled ( element guiGridlist )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:isSortingEnabled|isSortingEnabled}}
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:isSortingEnabled|sortingEnabled}}


===Required Arguments===  
===Required Arguments===  
Line 44: Line 44:
guiGridListSetSortingEnabled( newGridlist, newStatus ) -- Toggles the sorting for the gridlist
guiGridListSetSortingEnabled( newGridlist, newStatus ) -- Toggles the sorting for the gridlist
end
end
addCommandHandler( "tsort", toggleGridlistSortingState )
addCommandHandler( "togglesorting", toggleGridlistSortingState )
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 19:14, 13 June 2019

This function checks whether the gridlist sorting is enabled or disabled.

Syntax

bool guiGridListIsSortingEnabled ( element guiGridlist )

OOP Syntax Help! I don't understand this!

Method: GuiGridList:isSortingEnabled(...)
Variable: .sortingEnabled


Required Arguments

  • guiGridlist: The GUI gridlist you wish to check if sorting is enabled or not.

Returns

Returns true if sorting is enabled, false otherwise.

Example

Example 1: This example creates a gridlist with all server players and adds a command that enables and disables the gridlist sorting.

addEventHandler( "onClientResourceStart", resourceRoot,
	function()
		--Create the grid list element
		newGridlist = guiCreateGridList ( 0.50, 0.50, 0.20, 0.30, true )
		--Create a new grid list
		column = guiGridListAddColumn( newGridlist, "Players", 0.85 )
		showCursor( true )

		if ( column ) then --If the column has been created, fill it with players
			for id, player in ipairs(getElementsByType("player")) do
				local row = guiGridListAddRow ( newGridlist )
				guiGridListSetItemText ( newGridlist, row, column, getPlayerName ( player ), false, false )
			end
		end
	end
)

function toggleGridlistSortingState()

	local newStatus = not guiGridListIsSortingEnabled( newGridlist )

	outputChatBox( "The gridlist sorting is now ".. (newStatus and "Enabled" or "Disabled"), 230,230,230 )
	guiGridListSetSortingEnabled( newGridlist, newStatus ) -- Toggles the sorting for the gridlist
end
addCommandHandler( "togglesorting", toggleGridlistSortingState )

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