GuiGridListAutoSizeColumn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
__NOTOC__
__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 fake function is for use with blah & blah and does blahblahblabhalbhl
This allows you to automatically size a column to display everything in it correctly, with the most minimal width.


==Syntax==  
==Syntax==  
Line 12: Line 12:
===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 -->
*'''argumentName:''' description
*'''gridList:''' The grid list you want to add a column to
 
*'''columnIndex:''' Column ID
<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' description
*'''argumentName3:''' description


===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns ''true'' if the column was auto sized, ''false'' otherwise.
Returns ''true'' if blah, ''false'' otherwise.


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example creates a random list of numbers of various lengths. This function is used to adjust the width to display them all.
This example does...
<syntaxhighlight lang="lua">function clientsideResourceStart ()
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
    local numberList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) --Create a gridlist
<syntaxhighlight lang="lua">
    local column = guiGridListAddColumn( numberList, "Column Title", 0.85 ) --Create a column on the gridlist
--This line does...
    if ( column ) then --If the column was created successfully
blabhalbalhb --abababa
        local count = 0 -- Set the varible 'count' to the value 0
--This line does this...
        while count <= 10 do --Loop through 10 times adding random numbers in rows for the column
mooo
            local row = guiGridListAddRow ( numberList )
</syntaxhighlight>
            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", getRootElement(), clientsideResourceStart )</syntaxhighlight>
 


==See Also==
==See Also==

Revision as of 04:54, 8 October 2007

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 )

Required Arguments

  • gridList: The grid list you want to add a column to
  • columnIndex: Column ID

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", getRootElement(), clientsideResourceStart )


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