GridViewComponent

It is a Component that expresses a standardized UI Entity in the form of a grid. Since only a UI Entity visible on the screen is created and reused, it is an optimized form to express a large amount of Grid.

# Properties

[{"index":"Vector2 CellSize","0":"Fixed size of child UI Entity."}]

[{"index":"int32 FixedCount","0":"Sets a fixed number of rows or columns."}]

[{"index":"GridViewFixedType FixedType","0":"Sets whether to freeze rows or columns."}]

[{"index":"HorizontalScrollBarDirection HorizontalScrollBarDirection","0":"The orientation of the horizontal scrollbar."}]

[{"index":"Entity ItemEntity (HideFromInspector)","0":"The source that will be cloned when creating a child UI Entity. Entity set as ItemEntity is disabled."}]

[{"index":"func OnClear (HideFromInspector)","0":"A callback when not using a child UI Entity. The indexes of the child UI Entity and UI Entity are passed."}]

[{"index":"func OnRefresh (HideFromInspector)","0":"A callback when reusing a child UI Entity. The indexes of the child UI Entity and UI Entity are passed."}]

[{"index":"RectOffset Padding","0":"Sets the free space on the top, bottom, left, and right of the grid view."}]

[{"index":"Color ScrollBarBackgroundColor","0":"The background color of the scrollbar."}]

[{"index":"DataRef ScrollBarBackgroundImageRUID","0":"The background image of the scrollbar."}]

[{"index":"Color ScrollBarHandleColor","0":"The handle color of the scrollbar."}]

[{"index":"DataRef ScrollBarHandleImageRUID","0":"The handle image of the scrollbar."}]

[{"index":"float ScrollBarThickness","0":"The thickness of the scrollbar area."}]

[{"index":"ScrollBarVisibility ScrollBarVisible","0":"Sets whether to display the scrollbar automatically."}]

[{"index":"Vector2 Spacing","0":"The spacing between child UI Entities."}]

[{"index":"int32 TotalCount","0":"Total number of child UI Entities to be displayed in GridView."}]

[{"index":"boolean UseScroll","0":"Sets whether to use the scroll function."}]

[{"index":"VerticalScrollBarDirection VerticalScrollBarDirection","0":"The orientation of the vertical scrollbar."}]

##### inherited from Component:

[{"index":"boolean Enable (Sync)","0":"Checks whether Component is activated or not."}]

[{"index":"boolean EnableInHierarchy (ReadOnly) (HideFromInspector)","0":"Displays whether this Component is Enable in the hierarchy. If Entity Enable is false regardless of Component Enable, returns false."}]

[{"index":"Entity Entity (ReadOnly)","0":"The Entity that owns this component."}]

# Methods

[{"index":"Vector2 GetScrollNormalizedPosition()","0":"Returns the normalized position of the scroll bar."}]

[{"index":"float GetScrollNormalizedPosition(UITransformAxis axis)","0":"Returns the normalized position of the specified directional scroll bar."}]

[{"index":"void Refresh(boolean resetPos = true, boolean force = false)","0":"All the child UI Entities of GridView are updated. If restPos is true, initializes the scroll location after the update."}]

[{"index":"void RefreshIndex(int32 index)","0":"Updates the child UI Entity at a specific index. The indexes of the child UI Entity and the UI Entity are called through the OnRefresh callback."}]

[{"index":"void ResetScrollPosition(UITransformAxis axis)","0":"Moves the position of the scroll bar on the specified axis to the top position."}]

[{"index":"void SetScrollNormalizedPosition(UITransformAxis axis, float value)","0":"Moves the position of the scrollbar on the specified axis to the designated normalized position. The top is 0, the bottom is 1."}]

[{"index":"void SetScrollPositionByItemIndex(int32 index)","0":"Moves the scroll bar to a position where the child UI Entity at a specific index is visible."}]

##### inherited from Component:

[{"index":"boolean IsClient()","0":"Returns whether the current execution environment is a client or not."}]

[{"index":"boolean IsServer()","0":"Returns whether the current execution environment is a server or not."}]

# Events

[{"index":"ScrollPositionChangedEvent","0":"An event that occurs when the scroll position changes on a scrollable UI Entity. Only occurs if the UI Entity has ScrollLayoutGroupComponent or GridViewComponent."}]

# Examples

This is an example of arranging Entities according to a layout.
    
    
    @Component
    script InventorySlotDisplay extends Component
        property any Inventory = nil
        property Entity InventorySlot = nil
    
        @ExecSpace("ClientOnly")
        method void OnBeginPlay()
        self.Inventory.ItemEntity = self.InventorySlot
        self.Inventory.OnRefresh = self.OnRefresh
        self.Inventory.OnClear = self.OnClear
        self.Inventory.TotalCount = 10
        self.Inventory:Refresh()
        end
    
        method void OnRefresh(number index, Entity entity)
        entity:GetChildByName("Name").TextComponent.Text = tostring(index)
        end
    
        method void OnClear(number index, Entity entity)
        entity:GetChildByName("Name").TextComponent.Text = ""
        end
    end
    

# SeeAlso

  * TextComponent
  * global