Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Pageable

Classes

Class: Pageable

Extends Widget

Pageable

A Pageable widget organizes child widgets across multiple pages. Supports adding widgets to specific pages, navigating between pages, and querying the current and total number of pages.

Method: AddWidgetToPage

(method) Pageable:AddWidgetToPage(widget: Widget, pageIndex: number)

Adds a widget to the specified page of the Pageable.

@param widget — The widget to add.

@param pageIndex — The index of the page to add the widget to.

local page1 = widget:CreateChildWidget("textbox", "page1", 0, true)
page1:SetText("page1")
page1:AddAnchor("TOPLEFT", widget, 0, 0)
page1:AddAnchor("BOTTOMRIGHT", widget, 0, 0)

widget:AddWidgetToPage(page1, 1)

Method: NextPage

(method) Pageable:NextPage()

Navigates to the next page of the Pageable.

Method: PrevPage

(method) Pageable:PrevPage()

Navigates to the previous page of the Pageable.

Method: SetCurrentPageIndex

(method) Pageable:SetCurrentPageIndex(num: number)

Sets the current page index of the Pageable.

@param num — The page index to set.

Method: GetTotalPage

(method) Pageable:GetTotalPage()
  -> totalPage: number

Retrieves the total number of pages in the Pageable.

@return totalPage — The total number of pages.

Method: ChangePage

(method) Pageable:ChangePage(index: number)

Changes the current page of the Pageable to the specified index.

@param index — The page index to switch to.

Method: GetCurrentPageIndex

(method) Pageable:GetCurrentPageIndex()
  -> currentPageIndex: number

Retrieves the current page index of the Pageable.

@return currentPageIndex — The current page index. (default: 1, max: widget:GetTotalPage())

Method: SetPageCount

(method) Pageable:SetPageCount(num: number)

Sets the total number of pages for the Pageable. This must be set before Pageable:AddWidgetToPage.

@param num — The number of pages to set.