GuiGridListRemoveColumn: Difference between revisions
Jump to navigation
Jump to search
JonChappell (talk | contribs) No edit summary |
Zangomangu (talk | contribs) (Removed old issue) |
||
(9 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | |||
__NOTOC__ | __NOTOC__ | ||
This allows you to delete columns that exist in grid lists. | |||
==Syntax== | ==Syntax== | ||
<!-- 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"> | ||
bool guiGridListRemoveColumn ( element gridList, int columnIndex ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:removeColumn}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''gridList:''' The grid list you want to remove a column from | |||
*''' | *'''columnIndex:''' Column ID | ||
*''' | |||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the grid list column was successfully removed, ''false'' otherwise. | |||
Returns ''true'' if | |||
==Example== | ==Example== | ||
This example creates a grid list and adds 4 columns to it when the script starts. After 3 seconds, it randomly deletes a column and outputs to the chat box which column was deleted. | |||
<syntaxhighlight lang="lua">function deleteColumn () | |||
< | --Choose randomly which column to delete, output the chosen column into the chat box, and delete the column | ||
randomDeletion = math.random ( 1, 4 ) | |||
-- | if randomDeletion == 1 then | ||
outputChatBox ( "Removing column A" ) | |||
guiGridListRemoveColumn ( myGridList, columnA ) | |||
elseif randomDeletion == 2 then | |||
outputChatBox ( "Removing column B" ) | |||
guiGridListRemoveColumn ( myGridList, columnB ) | |||
elseif randomDeletion == 3 then | |||
outputChatBox ( "Removing column C" ) | |||
guiGridListRemoveColumn ( myGridList, columnC ) | |||
else | |||
outputChatBox ( "Removing column D" ) | |||
guiGridListRemoveColumn ( myGridList, columnD ) | |||
end | |||
end | |||
function clientsideResourceStart () | |||
--Create a gridlist | |||
myGridList = guiCreateGridList ( 0.30, 0.10, 0.5, 0.60, true ) | |||
--Create 4 columns for myGridList | |||
columnA = guiGridListAddColumn ( myGridList, "columnA Title", 0.25 ) | |||
columnB = guiGridListAddColumn ( myGridList, "columnB Title", 0.25 ) | |||
columnC = guiGridListAddColumn ( myGridList, "columnC Title", 0.25 ) | |||
columnD = guiGridListAddColumn ( myGridList, "columnD Title", 0.25 ) | |||
--Set a timer to trigger the deleteColumn function 3 seconds after the script starts | |||
setTimer ( deleteColumn, 3000, 1 ) | |||
end | |||
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 37: | Line 55: | ||
<!-- 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}} |
Latest revision as of 10:20, 30 January 2022
This allows you to delete columns that exist in grid lists.
Syntax
bool guiGridListRemoveColumn ( element gridList, int columnIndex )
OOP Syntax Help! I don't understand this!
- Method: GuiGridList:removeColumn(...)
Required Arguments
- gridList: The grid list you want to remove a column from
- columnIndex: Column ID
Returns
Returns true if the grid list column was successfully removed, false otherwise.
Example
This example creates a grid list and adds 4 columns to it when the script starts. After 3 seconds, it randomly deletes a column and outputs to the chat box which column was deleted.
function deleteColumn () --Choose randomly which column to delete, output the chosen column into the chat box, and delete the column randomDeletion = math.random ( 1, 4 ) if randomDeletion == 1 then outputChatBox ( "Removing column A" ) guiGridListRemoveColumn ( myGridList, columnA ) elseif randomDeletion == 2 then outputChatBox ( "Removing column B" ) guiGridListRemoveColumn ( myGridList, columnB ) elseif randomDeletion == 3 then outputChatBox ( "Removing column C" ) guiGridListRemoveColumn ( myGridList, columnC ) else outputChatBox ( "Removing column D" ) guiGridListRemoveColumn ( myGridList, columnD ) end end function clientsideResourceStart () --Create a gridlist myGridList = guiCreateGridList ( 0.30, 0.10, 0.5, 0.60, true ) --Create 4 columns for myGridList columnA = guiGridListAddColumn ( myGridList, "columnA Title", 0.25 ) columnB = guiGridListAddColumn ( myGridList, "columnB Title", 0.25 ) columnC = guiGridListAddColumn ( myGridList, "columnC Title", 0.25 ) columnD = guiGridListAddColumn ( myGridList, "columnD Title", 0.25 ) --Set a timer to trigger the deleteColumn function 3 seconds after the script starts setTimer ( deleteColumn, 3000, 1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )
See Also
General functions
- guiBringToFront
- getChatboxLayout
- getChatboxCharacterLimit
- guiCreateFont
- guiBlur
- guiFocus
- guiGetAlpha
- guiGetCursorType
- guiGetEnabled
- guiGetFont
- guiGetInputEnabled
- guiGetInputMode
- guiGetPosition
- guiGetProperties
- guiGetProperty
- guiGetScreenSize
- guiGetSize
- guiGetText
- guiGetVisible
- guiMoveToBack
- guiSetAlpha
- guiSetEnabled
- guiSetFont
- guiSetInputEnabled
- guiSetInputMode
- guiSetPosition
- guiSetProperty
- guiSetSize
- guiSetText
- guiSetVisible
- isChatBoxInputActive
- isConsoleActive
- isDebugViewActive
- isMainMenuActive
- isMTAWindowActive
- isTransferBoxActive
- setChatboxCharacterLimit
- setDebugViewActive
Browsers
Buttons
Checkboxes
Comboboxes
- guiCreateComboBox
- guiComboBoxAddItem
- guiComboBoxClear
- guiComboBoxGetItemCount
- guiComboBoxGetItemText
- guiComboBoxGetSelected
- guiComboBoxIsOpen
- guiComboBoxRemoveItem
- guiComboBoxSetItemText
- guiComboBoxSetOpen
- guiComboBoxSetSelected
Edit Boxes
- guiCreateEdit
- guiEditGetCaretIndex
- guiEditGetMaxLength
- guiEditIsMasked
- guiEditIsReadOnly
- guiEditSetCaretIndex
- guiEditSetMasked
- guiEditSetMaxLength
- guiEditSetReadOnly
Gridlists
- guiCreateGridList
- guiGridListAddColumn
- guiGridListAddRow
- guiGridListAutoSizeColumn
- guiGridListClear
- guiGridListGetColumnCount
- guiGridListGetColumnTitle
- guiGridListGetColumnWidth
- guiGridListGetHorizontalScrollPosition
- guiGridListGetItemColor
- guiGridListGetItemData
- guiGridListGetItemText
- guiGridListGetRowCount
- guiGridListGetSelectedCount
- guiGridListGetSelectedItem
- guiGridListGetSelectedItems
- guiGridListGetSelectionMode
- guiGridListIsSortingEnabled
- guiGridListGetVerticalScrollPosition
- guiGridListInsertRowAfter
- guiGridListRemoveColumn
- guiGridListRemoveRow
- guiGridListSetColumnTitle
- guiGridListSetColumnWidth
- guiGridListSetHorizontalScrollPosition
- guiGridListSetItemColor
- guiGridListSetItemData
- guiGridListSetItemText
- guiGridListSetScrollBars
- guiGridListSetSelectedItem
- guiGridListSetSelectionMode
- guiGridListSetSortingEnabled
- guiGridListSetVerticalScrollPosition
Memos
- guiCreateMemo
- guiMemoGetCaretIndex
- guiMemoGetVerticalScrollPosition
- guiMemoSetVerticalScrollPosition
- guiMemoIsReadOnly
- guiMemoSetCaretIndex
- guiMemoSetReadOnly
Progressbars
Radio Buttons
Scrollbars
Scrollpanes
- guiCreateScrollPane
- guiScrollPaneGetHorizontalScrollPosition
- guiScrollPaneGetVerticalScrollPosition
- guiScrollPaneSetHorizontalScrollPosition
- guiScrollPaneSetScrollBars
- guiScrollPaneSetVerticalScrollPosition
Static Images
Tab Panels
Tabs
Text Labels
- guiCreateLabel
- guiLabelGetColor
- guiLabelGetFontHeight
- guiLabelGetTextExtent
- guiLabelSetColor
- guiLabelSetHorizontalAlign
- guiLabelSetVerticalAlign
Windows
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel