Table Of Contents

Previous topic

BitmapType

Next topic

BookCtrlEvent

This Page

phoenix_title BookCtrlBase

A book control is a convenient way of displaying multiple pages of information, displayed one page at a time.

wxWidgets has five variants of this control:

This abstract class is the parent of all these book controls, and provides their basic interface. This is a pure virtual class so you cannot allocate it directly.


class_hierarchy Inheritance Diagram

Inheritance diagram for class BookCtrlBase

Inheritance diagram of BookCtrlBase


sub_classes Known Subclasses

AuiNotebook, Choicebook, Listbook, Notebook, Toolbook, Treebook


method_summary Methods Summary

__init__ Default constructor.
AddPage Adds a new page.
AdvanceSelection Cycles through the tabs.
ChangeSelection Changes the selection for the given page, returning the previous selection.
Create Constructs the book control with the given parameters.
DeleteAllPages Deletes all pages.
DeletePage Deletes the specified page, and the associated window.
GetCurrentPage Returns the currently selected page or None.
GetPage Returns the window at the given page position.
GetPageCount Returns the number of pages in the control.
GetPageImage Returns the image index for the given page.
GetPageText Returns the string for the given page.
GetSelection Returns the currently selected page, or NOT_FOUND if none was selected.
HitTest Returns the index of the tab at the specified position or NOT_FOUND if none.
InsertPage Inserts a new page at the specified position.
RemovePage Deletes the specified page, without deleting the associated window.
SetPageImage Sets the image index for the given page.
SetPageSize Sets the width and height of the pages.
SetPageText Sets the text for the given page.
SetSelection Sets the selection for the given page, returning the previous selection.

api Class API



class BookCtrlBase(Control, WithImages)

A book control is a convenient way of displaying multiple pages of information, displayed one page at a time.

Possible constructors:

BookCtrlBase()

BookCtrlBase(parent, winid, pos=DefaultPosition, size=DefaultSize,
             style=0, name='')

Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.



__init__ (self, parent, winid, pos=DefaultPosition, size=DefaultSize, style=0, name=’‘)

Constructs the book control with the given parameters.

See Create for two-step construction.

Parameters:
  • parent (Window) –
  • winid (int) –
  • pos (Point) –
  • size (Size) –
  • style (long) –
  • name (string) –





AddPage(self, page, text, select=False, imageId=NO_IMAGE)

Adds a new page.

The page must have the book control itself as the parent and must not have been added to this control previously.

The call to this function may generate the page changing events.

Parameters:
  • page (Window) – Specifies the new page.
  • text (string) – Specifies the text for the new page.
  • select (bool) – Specifies whether the page should be selected.
  • imageId (int) – Specifies the optional image index for the new page.
Return type:

bool

Returns:

True if successful, False otherwise.

Note

Do not delete the page, it will be deleted by the book control.

See also

InsertPage



AdvanceSelection(self, forward=True)

Cycles through the tabs.

The call to this function generates the page changing events.

Parameters:forward (bool) –


ChangeSelection(self, page)

Changes the selection for the given page, returning the previous selection.

This function behaves as SetSelection but does not generate the page changing events.

See User Generated Events vs Programmatically Generated Events for more information.

Parameters:page (int) –
Return type:int


Create(self, parent, winid, pos=DefaultPosition, size=DefaultSize, style=0, name='')

Constructs the book control with the given parameters.

Parameters:
  • parent (Window) –
  • winid (int) –
  • pos (Point) –
  • size (Size) –
  • style (long) –
  • name (string) –
Return type:

bool



DeleteAllPages(self)

Deletes all pages.

Return type:bool


DeletePage(self, page)

Deletes the specified page, and the associated window.

The call to this function generates the page changing events.

Parameters:page (int) –
Return type:bool


GetCurrentPage(self)

Returns the currently selected page or None.

Return type: Window


GetPage(self, page)

Returns the window at the given page position.

Parameters:page (int) –
Return type: Window


GetPageCount(self)

Returns the number of pages in the control.

Return type:int


GetPageImage(self, nPage)

Returns the image index for the given page.

Parameters:nPage (int) –
Return type:int


GetPageText(self, nPage)

Returns the string for the given page.

Parameters:nPage (int) –
Return type:string


GetSelection(self)

Returns the currently selected page, or NOT_FOUND if none was selected.

Note that this method may return either the previously or newly selected page when called from the EVT_BOOKCTRL_PAGE_CHANGED handler depending on the platform and so BookCtrlEvent.GetSelection should be used instead in this case.

Return type:int


HitTest(self, pt)

Returns the index of the tab at the specified position or NOT_FOUND if none.

If flags parameter is not None, the position of the point inside the tab is returned as well.

Parameters:pt (Point) – Specifies the point for the hit test.

Return more details about the point, see returned value is a combination of BK_HITTEST_NOWHERE, BK_HITTEST_ONICON, BK_HITTEST_ONLABEL, BK_HITTEST_ONITEM, BK_HITTEST_ONPAGE.

Return type:tuple
Returns:( int, flags )


InsertPage(self, index, page, text, select=False, imageId=NO_IMAGE)

Inserts a new page at the specified position.

Parameters:
  • index (int) – Specifies the position for the new page.
  • page (Window) – Specifies the new page.
  • text (string) – Specifies the text for the new page.
  • select (bool) – Specifies whether the page should be selected.
  • imageId (int) – Specifies the optional image index for the new page.
Return type:

bool

Returns:

True if successful, False otherwise.

Note

Do not delete the page, it will be deleted by the book control.

See also

AddPage



RemovePage(self, page)

Deletes the specified page, without deleting the associated window.

Parameters:page (int) –
Return type:bool


SetPageImage(self, page, image)

Sets the image index for the given page.

image is an index into the image list which was set with SetImageList .

Parameters:
  • page (int) –
  • image (int) –
Return type:

bool



SetPageSize(self, size)

Sets the width and height of the pages.

Parameters:size (Size) –

Note

This method is currently not implemented for wxGTK.



SetPageText(self, page, text)

Sets the text for the given page.

Parameters:
  • page (int) –
  • text (string) –
Return type:

bool



SetSelection(self, page)

Sets the selection for the given page, returning the previous selection.

Notice that the call to this function generates the page changing events, use the ChangeSelection function if you don’t want these events to be generated.

Parameters:page (int) –
Return type:int

See also

GetSelection


Properties



CurrentPage

See GetCurrentPage



PageCount

See GetPageCount



Selection

See GetSelection and SetSelection