GuiGridListInsertRowAfter: Difference between revisions
Jump to navigation
Jump to search
(Fix incorrect return.) |
|||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | {{Client function}} | ||
__NOTOC__ | __NOTOC__ | ||
This allows you to insert a new row after a specified row. Good for inserting new rows in the middle of existing rows. | This allows you to insert a new row after a specified row, and simultaneously set text. Good for inserting new rows in the middle of existing rows. To insert at the top use -1 as row index. | ||
==Syntax== | ==Syntax== | ||
Line 8: | Line 8: | ||
int guiGridListInsertRowAfter ( element gridList, int rowIndex ) | int guiGridListInsertRowAfter ( element gridList, int rowIndex ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{New feature/item|3.0153|1.5.3|| | |||
<syntaxhighlight lang="lua"> | |||
int guiGridListInsertRowAfter ( element gridList [, int rowIndex, int/string itemText1, int/string itemText2, ... ] ) | |||
</syntaxhighlight> | |||
}} | |||
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:insertRowAfter}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''gridList:''' The grid list you want to add a row to | *'''gridList:''' The grid list you want to add a row to | ||
*'''rowIndex:''' Row ID of the row you want to insert the '''new row''' after. | *'''rowIndex:''' Row ID of the row you want to insert the '''new row''' after. | ||
===Optional Arguments=== | |||
{{New feature/item|3.0153|1.5.3|| | |||
*'''itemText1:''' The text for the first column item in the row. Either a string or a number can be passed (use numbers for sorting purposes). | |||
*'''itemText2:''' The text for the second column item in the row. Either a string or a number can be passed (use numbers for sorting purposes). | |||
*'''...:''' Item text for any other columns | |||
}} | |||
===Returns=== | ===Returns=== | ||
Returns '' | Returns ''row id'' if the row was successfully added, ''false'' otherwise. | ||
==Example== | ==Example== | ||
< | This example would create a gridlist then add the current players in the server and if anyone joins, it would insert a row at the bottom. | ||
<syntaxhighlight lang="lua">gridlist = guiCreateGridList(100,100,200,100,false) | |||
-- Add | guiGridListAddColumn(gridlist,"Players",0.50) | ||
for i,v in ipairs(getElementsByType("player"))do | |||
guiGridListSetItemText(gridlist,guiGridListAddRow(gridlist),1,getPlayerName(v),false,false) | |||
end | |||
addEventHandler("onClientPlayerJoin",root,function() | |||
guiGridListSetItemText(gridlist,guiGridListInsertRowAfter(gridlist,guiGridListGetRowCount(gridlist)),1,getPlayerName(source),false,false)--Add row at the bottom of the gridlist and name it the players name | |||
end) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
<!-- 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 06:27, 16 January 2023
This allows you to insert a new row after a specified row, and simultaneously set text. Good for inserting new rows in the middle of existing rows. To insert at the top use -1 as row index.
Syntax
int guiGridListInsertRowAfter ( element gridList, int rowIndex )
int guiGridListInsertRowAfter ( element gridList [, int rowIndex, int/string itemText1, int/string itemText2, ... ] )
OOP Syntax Help! I don't understand this!
- Method: GuiGridList:insertRowAfter(...)
Required Arguments
- gridList: The grid list you want to add a row to
- rowIndex: Row ID of the row you want to insert the new row after.
Optional Arguments
- itemText1: The text for the first column item in the row. Either a string or a number can be passed (use numbers for sorting purposes).
- itemText2: The text for the second column item in the row. Either a string or a number can be passed (use numbers for sorting purposes).
- ...: Item text for any other columns
Returns
Returns row id if the row was successfully added, false otherwise.
Example
This example would create a gridlist then add the current players in the server and if anyone joins, it would insert a row at the bottom.
gridlist = guiCreateGridList(100,100,200,100,false) guiGridListAddColumn(gridlist,"Players",0.50) for i,v in ipairs(getElementsByType("player"))do guiGridListSetItemText(gridlist,guiGridListAddRow(gridlist),1,getPlayerName(v),false,false) end addEventHandler("onClientPlayerJoin",root,function() guiGridListSetItemText(gridlist,guiGridListInsertRowAfter(gridlist,guiGridListGetRowCount(gridlist)),1,getPlayerName(source),false,false)--Add row at the bottom of the gridlist and name it the players name end)
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