GuiGridListAutoSizeColumn: Difference between revisions
Jump to navigation
Jump to search
JonChappell (talk | contribs) No edit summary |
(OOP syntax) |
||
(6 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | {{Client function}} | ||
__NOTOC__ | |||
<!-- Describe in plain english what this function does. Don't go into details, just give an overview --> | <!-- Describe in plain english what this function does. Don't go into details, just give an overview --> | ||
This | This allows you to automatically size a column to display everything in it correctly, with the most minimal width. | ||
==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 guiGridListAutoSizeColumn ( element gridList, int columnIndex ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Element/GUI/Gridlist|GuiGridList]]:autoSizeColumn}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type --> | <!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type --> | ||
*''' | *'''gridList:''' The [[Element/GUI/Gridlist|grid list]] element where the column is located. | ||
*'''columnIndex:''' The ID of the column you want to be auto-sized. | |||
*''' | |||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the column was auto-sized, ''false'' otherwise. | |||
Returns ''true'' if | |||
==Example== | ==Example== | ||
This example creates a random list of numbers of various lengths. This function is used to adjust the width to display them all. | |||
This | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function clientsideResourceStart () | ||
local numberList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) --Create a gridlist | |||
-- | local column = guiGridListAddColumn( numberList, "Column Title", 0.85 ) --Create a column on the gridlist | ||
if ( column ) then --If the column was created successfully | |||
</syntaxhighlight> | local count = 0 -- Set the varible 'count' to the value 0 | ||
while count <= 10 do --Loop through 10 times adding random numbers in rows for the column | |||
local row = guiGridListAddRow ( numberList ) | |||
guiGridListSetItemText ( numberList, row, column, tostring(math.random(0, 10) ^ 100), false, false ) | |||
count = count + 1 | |||
end | |||
guiGridListAutoSizeColumn ( numberList, column ) --After the numbers are added in rows, perform auto sizing on the column | |||
end | |||
end | |||
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )</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 21:07, 7 November 2018
This allows you to automatically size a column to display everything in it correctly, with the most minimal width.
Syntax
bool guiGridListAutoSizeColumn ( element gridList, int columnIndex )
OOP Syntax Help! I don't understand this!
- Method: GuiGridList:autoSizeColumn(...)
Required Arguments
- gridList: The grid list element where the column is located.
- columnIndex: The ID of the column you want to be auto-sized.
Returns
Returns true if the column was auto-sized, false otherwise.
Example
This example creates a random list of numbers of various lengths. This function is used to adjust the width to display them all.
function clientsideResourceStart () local numberList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) --Create a gridlist local column = guiGridListAddColumn( numberList, "Column Title", 0.85 ) --Create a column on the gridlist if ( column ) then --If the column was created successfully local count = 0 -- Set the varible 'count' to the value 0 while count <= 10 do --Loop through 10 times adding random numbers in rows for the column local row = guiGridListAddRow ( numberList ) guiGridListSetItemText ( numberList, row, column, tostring(math.random(0, 10) ^ 100), false, false ) count = count + 1 end guiGridListAutoSizeColumn ( numberList, column ) --After the numbers are added in rows, perform auto sizing on the column end 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