Skip to content

gridlist

Thomas edited this page May 31, 2020 · 2 revisions

obj_uiZ_gridlist

A simple way of displaying lists with multiple sets of data. The data can be stored in a ds_grid. Any cell is indexed by default using [# column, row], but this can be changed using the "orientation" property. This gridlist can be used to select nothing, single cells, rows or columns.

If should put strings inside your ds_grid, it will draw text in a certain cell. If you put a number inside your ds_list/ds_grid then it will attempt to draw a sprite in that specific cell.

If you put a real number 0 inside a cell, then it won't draw anything there. And if you put a real number 1 inside a cell then it will attempt to draw the same thing that is in the mainlist. (so in the topbar)
Make sure that you don't have any sprites with index 0 or 1 to draw in the grid!

Properties Variables

  • mainlist[-1]: The ds_list holding the names of your columns which will be displayed at the top.
  • maingrid[-1]: The ds_grid holding all cell information, but not column names.
  • orientation[0]: Whether the grid should interpreted as [# column, row] (value of 0) or as [# row, column] (value of 1).
  • destroylists[true]: Whether to automatically destroy all the ds lists and grids, when destroying the gridlist object or when the game/room ends.
  • barsize[0.2]: The size of each grid row.
  • barsizetype[dp]: The size type of each grid row.
  • minbarsize[0.2]: The minimum size a column can be.
  • minbarsizetype[dp]: The type of the minimum size a column can be.
  • listheightmargin[2]: Pixel value how much extra height you want to cell to have, besides the text height.
  • drawdivider[true]: Wether to draw a divider on the top bar between two columns. Independent of drawdivider.
  • dividercolor[c_black]: The color the little topbar column divider line should have.
  • enabledivider[true]: Whether the mouse should be able to interact with the divider. Independent of drawdivider.
  • mousemargin[5]: How many pixels of space should be grabbable around the divider.
  • textcolor[c_black]: The color of your text. Works on all text in the object.
  • textmargin[3]: The margin in pixels between the left side of the cell and the text inside that cell.
  • font[-1]: the font to use for all text in the object, a value of -1 means font will be ignored.
  • imagescale[0.9]: how much space sprites should take up inside a cell. A value of 1 means all space and a value of 0 means no space. Usefull for giving sprites margins.
  • scrollbarwidth[0.15]: The width of the scrollbar in scrollbarwidthtype.
  • scrollbarwidthtype[dp]: The type of width of the scrollbar.
  • scrollbarsprite[spr_uiZ_scrollbar_16]: The sprite to use for the scroll bar, see uiz_drawscrollbar_ for more information.
  • scrollbarbacktextmode[uiz_texturemode_fill]: How to draw the background. You can choose from uiz_texturemode_fill, texturemode_tile and texturemode_tilefit. See uiz_drawscrollbar_ for more information.
  • scrollbarAnimation[uiz_smoothstep]: The animation to use for the scrollbar, when using the scrollwheel or clicking when on the scrollbar buttons.
  • scrollbarAnimationTime[0.3]: The time in seconds the animation should take when using the scrollwheel or clicking when on the scrollbar buttons.
  • scrollspeed[1]: How many grid entries to scroll every time you scroll the scroll wheel or press the scrollbar buttons.
  • enablescroll[true]: Whether to allow the scrollbar to be enabled.
  • normalcolor[c_white]: The color of a cell when the mouse isn't interacting with it.
  • selectiononcolor[c_ltgray]: The color of a cell which has the mouse over it.
  • selectionincolor[c_gray]: The color of a cell which has the mouse clicked.
  • normalalpha[c_white]: The alpha of a cell when the mouse isn't interacting with it. (will be multiplied with the object alpha)
  • selectiononalpha[c_ltgray]: The alpha of a cell which has the mouse over it. (will be multiplied with the object alpha)
  • selectioninalpha[c_gray]: The alpha of a cell which has the mouse clicked. (will be multiplied with the object alpha)

This object has a background, and all it's associated variables about which you can learn more here. This object also have another background type prefixed with topbar_. Use the uiz_background_topbar_ scripts to set the look and feel of the top bar (displaying the column names).

Functions

  • uiz_gridlist_setgrid(instanceid,columnlist[-1],maingrid[-1]):
    • instanceid: the instance id of the instance you want to modify
    • columnlist[-1]: A ds_list holding the names of your columns which will be displayed at the top.
  • maingrid[-1]: A ds_grid holding all cell information, but not column names.
  • uiz_gridlist_autodestroy_datastructures(instanceid,enabled[true]):
    • instanceid: the instance id of the instance you want to modify
    • enabled[true]: Whether to automatically destroy all the ds lists and grids, when destroying the gridlist object or when the game/room ends.
  • uiz_gridlist_setbarsize(instanceid,barsize[20],barsizetype[px],minbarwidth[20],minbarwidthtype[px]):
    • instanceid: the instance id of the instance you want to modify
    • barsize[20]: The size of each grid row.
    • barsizetype[px]: The size type of each grid row.
    • minbarsize[20]: The minimum size a column can be.
    • minbarsizetype[px]: The type of the minimum size a column can be.
  • uiz_gridlist_settextsettings(instanceid,margin[3],color[c_black],font[-1]):
    • instanceid: the instance id of the instance you want to modify
    • margin[3]: The margin in pixels between the left side of the cell and the text inside that cell.
    • color[c_black]: The color of your text. Works on all text in the object.
    • font[-1]: the font to use for all text in the object, a value of -1 means font will be ignored.
  • uiz_gridlist_setmargin(instanceid,listheightmargin[2]):
    • instanceid: the instance id of the instance you want to modify
    • listheightmargin[2]: Pixel value how much extra height you want to cell to have, besides the text height.
  • uiz_gridlist_setdivider(instanceid,enable mouse[true], draw[true],color[c_black]):
    • instanceid: the instance id of the instance you want to modify
    • enable mouse[true]: Whether the mouse should be able to interact with the divider. Independent of drawdivider.
    • draw[true]: Wether to draw a divider on the top bar between two columns. Independent of drawdivider.
    • color[c_black]: The color the little topbar column divider line should have.
  • uiz_gridlist_setcolors(instanceid,cell normal[c_white],cell over[c_ltgray],cell click[c_gray]):
    • instanceid: the instance id of the instance you want to modify
    • cell normal[c_white]: The color of a cell when the mouse isn't interacting with it.
    • cell over[c_ltgray]: The color of a cell which has the mouse over it.
    • cell click[c_gray]: The color of a cell which has the mouse clicked.
  • uiz_gridlist_selectionmode(instanceid,selectionmode[2],keepselection[false]):
    • instanceid: the instance id of the instance you want to modify
    • selectionmode[uiz_gridlist_selection_row]: What should be selected when the mouse hovers over the object.
      You can choose for the following modes:
    • uiz_gridlist_selection_none: Nothing will be selected.
    • uiz_gridlist_selection_cell: A single cell will be selected.
    • uiz_gridlist_selection_row: A single row will be selected.
    • uiz_gridlist_selection_column: A single column will be selected.
    • keepselected[false]: Whether to keep the selection from selectionmode selected. The clickedx/y variables will still work if this is disabled.
  • uiz_gridlist_enablescrollbar(instanceid,enabled[true]):
    • instanceid: the instance id of the instance you want to modify
    • enabled[true]: Whether to allow the scrollbar to be enabled.
  • uiz_gridlist_setscrollbar(instanceid,scrollbarwidth[16],scrollbarsprite[spr_uiZ_scrollbar],scrollbarbacktexmode[uiz_texturemode_fill],scrollspeed[1]):
    • instanceid: the instance id of the instance you want to modify
    • scrollbarwidth[0.15]: The width of the scrollbar in scrollbarwidthtype.
    • scrollbarwidthtype[dp]: The type of width of the scrollbar.
    • scrollbarsprite[spr_uiZ_scrollbar_16]: The sprite to use for the scroll bar, see uiz_drawscrollbar_ for more information.
    • scrollbarbacktextmode[uiz_texturemode_fill]: How to draw the background. You can choose from uiz_texturemode_fill, texturemode_tile and texturemode_tilefit. See uiz_drawscrollbar_ for more information.
    • scrollspeed[1]: How many grid entries to scroll every time you scroll the scroll wheel or press the scrollbar buttons.
    • scrollbarAnimation[uiz_smoothstep]: The animation to use for the scrollbar, when using the scrollwheel or clicking when on the scrollbar buttons.
    • scrollbarAnimationTime[0.3]: The time in seconds the animation should take when using the scrollwheel or clicking when on the scrollbar buttons.

Readable variables

  • selectedx: The column of the selected cell, starting from 0. Has a value of -1 at the beginning, when nothing is selected
  • selectedy: The row of the selected cell, starting from 0. Has a value of -1 at the beginning, when nothing is selected
  • clickedx: The column of the last clicked cell, starting from 0. Has a value of -1 when nothing is selected
  • clickedy: The row of the last clicked cell, starting from 0. Has a value of -1 when nothing is selected
  • kmouseover: Info about the mouse.

Visuals

Here is some example code:

list=uiz_c(obj_uiZ_gridlist)
list.posinframex=uiz_fill
list.posinframey=uiz_fill
list.mainlist=ds_list_create()
ds_list_add(list.mainlist,"HELLOW!!","something else","other information")
list.listlist=ds_list_create()
ds_list_add(list.listlist,ds_list_create(),ds_list_create(),ds_list_create())
ds_list_add(list.listlist[| 0],"opetion1","2","3","4")
ds_list_add(list.listlist[| 1],"unoopetion1","dos","tres","amievenspellingthisright?")
ds_list_add(list.listlist[| 2],"1 panty","2 panties","3 panties","4 panties")
uiz_fixgeneralpos(list)

Wiki pages

🏑Home / General
πŸ“ƒTutorials
πŸ‘ͺ Parent
↕️ Positioning
πŸ›  Fixing & Updating
πŸ• Depth
πŸ“ƒ Templates and Examples
πŸŒ† Background
πŸ“‡ Structures
🎈 Objects

obj_uiZ_3waybutton
obj_uiZ_button
obj_uiZ_checkbox
obj_uiZ_clock
obj_uiZ_colorbox
obj_uiZ_cover
obj_uiZ_drawdslist obj_uiZ_dropdown
obj_uiZ_easybutton
obj_uiZ_frame
obj_uiZ_framescrollbar
obj_uiZ_functionbar
obj_uiZ_gradientsquare
obj_uiZ_gradientroundrect
obj_uiZ_gridlist
obj_uiZ_huesquare
obj_uiZ_loadingbar
obj_uiZ_loadingcircle
obj_uiZ_menubutton
obj_uiZ_mousemenu
obj_uiZ_radiobox
obj_uiZ_rotator
obj_uiZ_slider
obj_uiZ_scrollbar
obj_uiZ_slider_2col
obj_uiZ_slickslider
obj_uiZ_slideframe
obj_uiZ_sprbutton
obj_uiZ_spriteanimationbutton
obj_uiZ_spritecounter
obj_uiZ_stringbox
obj_uiZ_sliderstruct
obj_uiZ_surfacecanvas
obj_uiZ_sprite
obj_uiZ_square
obj_uiZ_squarebutton
obj_uiZ_swipicon
obj_uiZ_switch
obj_uiZ_tabslider
obj_uiZ_tabs
obj_uiZ_treelist
obj_uiZ_text
obj_uiZ_text_background
obj_uiZ_textarea
obj_uiZ_valuebox


🎈 Your own objects
🚫 Destroy
🐭 Mouse
πŸ’» Windows (uiz)
🌌 Animations
❓ General
πŸ“’ Numbers
πŸ“’ Strings
✏️ Draw
🚩 Popup
πŸ“‚ Files
πŸ’» Windows (os)
Clone this wiki locally