Class widget:notebook

Notebook widget
This module is only available from the UI process Lua state.

The notebook widget allows switching between a set of widgets, only one of which will be visible at a given time.

Methods

notebook:count ()

Get the number of pages in the notebook.

Return Values

  • integer
    The number of pages in the notebook.

notebook:current ()

Get the page number of the currently visible page.

Return Values

  • integer
    The 1-based index of the currently visible page.

notebook:get_title (child)

Get the tab label text for a particular child widget.

Parameters

  • child
    Type: widget
    The child widget.

notebook:set_title (child, title)

Set the tab label text for a particular child widget.

Parameters

  • child
    Type: widget
    The child widget.
  • title
    Type: string
    The new tab label text.

notebook:indexof (child)

Get the page number of the given child widget.

Parameters

  • child
    Type: widget
    The child widget.

Return Values

  • integer
    The 1-based index of the child widget.

notebook:insert (index, child)

Add a new child widget to the notebook, adding a new page.

Parameters

  • index
    Type: integer
    Optional
    Position to add the widget. Defaults to adding at the end.
  • child
    Type: widget
    The new child widget to add.

notebook:switch (index)

Switch to a notebook page.

Parameters

  • index
    Type: integer
    The 1-based index of the page to switch to.

notebook:reorder (child, index)

Move a given child widget to a different position.

Parameters

  • child
    Type: widget
    The child widget.
  • index
    Type: integer
    The 1-based index of the new page number, or -1 to move it to the last position.

Properties

notebook.show_tabs

Type: boolean
Default: true
Read-write
Whether a row of tabs will be shown above the notebook pages.

notebook.show_border

Type: boolean
Default: false
Read-write
Whether a border will be shown around the notebook pages.

Signals

"key-press"

Emitted when a key is pressed while the notebook widget has the input focus.

Parameters

  • modifiers
    Type: table
    An array of strings, one for each modifier key held.
  • key
    Type: string
    The key that was pressed, if printable, or a keysym otherwise.

Return Values

  • boolean
    true if the event has been handled and should not be propagated further.

"page-added"

Emitted immediately after a new widget is added to the notebook, adding a new page.

Parameters

  • child
    Type: widget
    The new child widget.
  • index
    Type: integer
    The 1-based page index of the new child widget.

"page-removed"

Emitted immediately after a widget is removed from the notebook, removing a page.

Parameters

  • child
    Type: widget
    The child widget that was removed.

"page-reordered"

Emitted immediately after a notebook page has been reordered.

Parameters

  • child
    Type: widget
    The child widget that was reordered.
  • index
    Type: integer
    The new 1-based page index of the child widget.

"switch-page"

Emitted when the currently visible page of the notebook is changed.

Parameters

  • child
    Type: widget
    The child widget that is being switched to.
  • index
    Type: integer
    The 1-based index of the page that is being switched to.

Attribution

Copyright