GuiGridListRemoveRow: Difference between revisions
Jump to navigation
Jump to search
JonChappell (talk | contribs) No edit summary |
(OOP syntax) |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | |||
__NOTOC__ | __NOTOC__ | ||
This allows you to delete rows that exist in grid lists. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool guiGridListRemoveRow ( element gridList, int rowIndex ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:removeRow}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''gridList:''' The grid list you want to remove a row from | |||
*''' | *'''rowIndex:''' The row ID which you want to remove | ||
*''' | |||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the grid list row was successfully removed, ''false'' otherwise. | |||
Returns ''true'' if | |||
==Example== | ==Example== | ||
< | In this example, when the script starts, a grid list with 1 column and 2 rows, which have text assigned to them. After 3 seconds, one row is randomly deleted. | ||
<syntaxhighlight lang="lua">function deleteRow () | |||
--Choose randomly which row to delete, output the | |||
-- | --chosen row into the chat box, and delete the row | ||
randomDeletion = math.random ( 1, 2 ) | |||
if randomDeletion == 1 then | |||
outputChatBox ( "Removing row A" ) | |||
</syntaxhighlight> | guiGridListRemoveRow ( myGridList, rowA ) | ||
elseif randomDeletion == 2 then | |||
outputChatBox ( "Removing row B" ) | |||
guiGridListRemoveRow ( myGridList, rowB ) | |||
end | |||
end | |||
function clientsideResourceStart () | |||
--Create a gridlist | |||
myGridList = guiCreateGridList ( 0.30, 0.10, 0.5, 0.60, true ) | |||
--Create a column for myGridList to add rows into | |||
columnA = guiGridListAddColumn ( myGridList, "columnA Title", 0.25 ) | |||
--Create 2 rows for ColumnA and set the text for them | |||
rowA = guiGridListAddRow ( myGridList ) | |||
guiGridListSetItemText ( myGridList, rowA, columnA, "Hello", false, false ) | |||
rowB = guiGridListAddRow ( myGridList ) | |||
guiGridListSetItemText ( myGridList, rowB, columnA, "World!", false, false ) | |||
--Trigger the function to delete a row 3 seconds after the script starts | |||
setTimer ( deleteRow, 3000, 1 ) | |||
end | |||
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{GUI functions}} | {{GUI functions}} | ||
{{GUI_events}} |
Latest revision as of 21:18, 7 November 2018
This allows you to delete rows that exist in grid lists.
Syntax
bool guiGridListRemoveRow ( element gridList, int rowIndex )
OOP Syntax Help! I don't understand this!
- Method: GuiGridList:removeRow(...)
Required Arguments
- gridList: The grid list you want to remove a row from
- rowIndex: The row ID which you want to remove
Returns
Returns true if the grid list row was successfully removed, false otherwise.
Example
In this example, when the script starts, a grid list with 1 column and 2 rows, which have text assigned to them. After 3 seconds, one row is randomly deleted.
function deleteRow () --Choose randomly which row to delete, output the --chosen row into the chat box, and delete the row randomDeletion = math.random ( 1, 2 ) if randomDeletion == 1 then outputChatBox ( "Removing row A" ) guiGridListRemoveRow ( myGridList, rowA ) elseif randomDeletion == 2 then outputChatBox ( "Removing row B" ) guiGridListRemoveRow ( myGridList, rowB ) end end function clientsideResourceStart () --Create a gridlist myGridList = guiCreateGridList ( 0.30, 0.10, 0.5, 0.60, true ) --Create a column for myGridList to add rows into columnA = guiGridListAddColumn ( myGridList, "columnA Title", 0.25 ) --Create 2 rows for ColumnA and set the text for them rowA = guiGridListAddRow ( myGridList ) guiGridListSetItemText ( myGridList, rowA, columnA, "Hello", false, false ) rowB = guiGridListAddRow ( myGridList ) guiGridListSetItemText ( myGridList, rowB, columnA, "World!", false, false ) --Trigger the function to delete a row 3 seconds after the script starts setTimer ( deleteRow, 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