Jump to content

[REL] Static Grid List v0.2a


AriosJentu

Recommended Posts

Hi all.

Static CeGUI Grid List

With this resource you can use new grid list. Maybe you can find bugs :D

What you can with this Grid List:

- Add/remove colums, rows

- Clear rows

- Set/get item color/text

- Get row/column count

- Set/get item selection and mouse-joining-to-item color (personal for item)

In updates:

- Fixed bug with creating colums for static list

- Removed ListID argument for creation

- Added resize gridlist function

- AddRow and AddColumn returns their identification

In future versions i would add sorting.

Functions:

guiCreateStaticGridList(int PosX, int PosY, int Width, int Height, bool Relative, element Parent) 

Arguments:

- PosX, PosY, Width, Height - Static Grid List position and size

- Relative - GUI relative

- Parent - GUI parent

Create static grid list

Returns: static grid list identification and background {int, gui-staticimage}

guiStaticGridListAddColumn(int ListID, string TitleText, int Width) 

Adding column to static grid list. Width > 0 and < 1

Returns: static grid list column identification {int}

guiStaticGridListSetColumnTitle(int ListID, int ColumnID, string TitleText) 

Set column title text

guiStaticGridListGetColumnTitle(int ListID, int ColumnID) 

Get column title text

Returns: Column title text {string}

guiStaticGridListAddRow(int ListID) 

Adding row to static grid list

Returns: static grid list row identification {int}

guiStaticGridListSetItemText(int ListID, int RowID, int ColumnID, string Text) 

Set grid list item text

Returns: Row {gul-label}

guiStaticGridListGetItemText(int ListID, int RowID, int ColumnID) 

Get grid list item text

Returns: String of item text {string}

guiStaticGridListSetItemColor(int ListID, int RowID, int ColumnID [, int Red, int Green, int Blue]) 

Set grid list item text color

guiStaticGridListGetItemColor(int ListID, int RowID, int ColumnID) 

Get grid list item text color

Returns: RGB 3 integers {int, int, int}

guiStaticGridListClear(int ListID) 

Clear all static grid list rows

guiStaticGridListRemoveColumn(int ListID, int ColumnID) 

Removes static grid list column by column id

guiStaticGridListRemoveRow(int ListID, int RowID) 

Removes static grid list row by row id

guiStaticGridListSetItemSelectedColor(int ListID, int RowID [, int Red, int Green, int Blue, int Alpha]) 

Set color to selected item by row id

If red, green, blue and alpha not setted, color reset to defaults

guiStaticGridListGetItemSelectedColor(int ListID, int RowID [, bool Hex]) 

Get color of selected item by row id

Returns: RGB 4 integers or String AARRGGBB {int, int, int, int} {string}

guiStaticGridListSetItemJoinedColor(int ListID, int RowID [, int Red, int Green, int Blue, int Alpha]) 

Set color to joined-mouse-to-item by row id

If red, green, blue and alpha not setted, color reset to defaults

guiStaticGridListGetItemJoinedColor(int ListID, int RowID [, bool Hex]) 

Get color of joined-mouse-to-item by row id

Returns: RGB 4 integers or String AARRGGBB {int, int, int, int} {string}

guiStaticGridListSetSelectedItem(int ListID, int RowID [, int ColumnID]) 

Set selected item of static grid list

guiStaticGridListGetSelectedItem(int ListID) 

Get selected item of static grid list

Returns: nil if not selected or row id of selected item {nil} {int}

guiStaticGridListGetRowCount(int ListID) 

Get row count of static grid list

Returns: Rows count of grid list {int}

guiStaticGridListGetColumnCount(int ListID) 

Get column count of static grid list

Returns: Column count of grid list {int}

guiStaticGridListSetSize(int ListID, int Width,  int Height, bool Relative) 

Set static grid list size

Event

          onClientStaticGridListClickItem

Triggers when local player click on row element

Parameters:

int ListID, int RowID, int ColumnID or 1 

- ListID - Grid List Identificator

- RowID - Clicked Row Identificator

- ColumnID - Clicked Column Identificator

Source - LocalPlayer

Notes:

Row Identification and Column Identification start from 1.

Download

GitHub

Screenes:

Left - Static grid list, right - default grid list

4eq9iVe.png

Yfid49c.png

YpYInsn.jpg

Example:

addEventHandler("onClientResourceStart", root, 
    function() 
        local list = guiCreateStaticGridList(100, 100, 400, 400) 
        guiStaticGridListAddColumn(list, "Авто", 0.1) 
        guiStaticGridListAddColumn(list, "Лалка", 0.2) 
        guiStaticGridListAddColumn(list, "Ааока", 0.1) 
        guiStaticGridListAddColumn(list, "Тралл", 0.1) 
        guiStaticGridListAddRow(list) 
        guiStaticGridListAddRow(list) 
        guiStaticGridListAddRow(list) 
        guiStaticGridListAddRow(list) 
        guiStaticGridListAddRow(list) 
        guiStaticGridListAddRow(list) 
        guiStaticGridListSetItemText(list, 1, 2, "C2R1") 
        guiStaticGridListSetItemText(list, 2, 1, "C1R2") 
        guiStaticGridListSetItemText(list, 1, 1, "C1R1") 
        guiStaticGridListSetItemText(list, 2, 2, "C2R2") 
        guiStaticGridListSetItemText(list, 3, 4, "C4R3") 
        guiStaticGridListSetItemText(list, 4, 3, "C3R4") 
        guiStaticGridListSetItemText(list, 3, 3, "C3R3") 
        guiStaticGridListSetItemText(list, 4, 4, "C4R4") 
        --guiStaticGridListRemoveColumn(list, 1) 
        --guiStaticGridListRemoveColumn(list, 2) 
        --guiStaticGridListRemoveColumn(list, 3) 
        --guiStaticGridListRemoveColumn(list, 4) 
        --guiStaticGridListRemoveRow(list, 2) 
        --guiStaticGridListClear(list) 
        guiStaticGridListSetItemSelectedColor(list, 2, 255, 0, 0) 
        guiStaticGridListSetItemSelectedColor(list, 3, 0, 255, 0) 
        guiStaticGridListSetItemSelectedColor(list, 4, 0, 0, 255) 
        guiStaticGridListSetItemJoinedColor(list, 2, 100, 0, 0) 
        guiStaticGridListSetItemJoinedColor(list, 3, 0, 100, 0) 
        guiStaticGridListSetItemJoinedColor(list, 4, 0, 0, 100) 
        guiStaticGridListSetColumnTitle(list, 1, "Тест") 
        guiStaticGridListSetSelectedItem(list, 2) 
        outputDebugString(tostring(guiStaticGridListGetSelectedItem(list)).." "..tostring(guiStaticGridListGetRowCount(list)).." "..tostring(guiStaticGridListGetColumnCount(list)).." "..tostring(guiStaticGridListGetItemText(list, 1, 2))) 
        guiStaticGridListSetItemColor(list, 1, 2, 255, 0, 0) 
    end) 

Edited by Guest
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...