# wx.VarHScrollHelper¶

This class provides functions wrapping the wx.VarScrollHelperBase class, targeted for horizontal-specific scrolling.

Like wx.VarScrollHelperBase, this class is mostly only useful to those classes built into wxWidgets deriving from here, and this documentation is mostly only provided for referencing the functions provided by this class. You will likely want to derive your window from wx.HScrolledWindow rather than from here directly.

## Class Hierarchy¶

Inheritance diagram for class VarHScrollHelper:

## Methods Summary¶

 __init__ Constructor taking the target window to be scrolled by this helper class. EstimateTotalWidth This class forwards calls from EstimateTotalSize to this function so derived classes can override either just the height or the width estimation, or just estimate both differently if desired in any wx.HVScrolledWindow derived class. GetColumnCount Returns the number of columns the target window contains. GetVisibleColumnsBegin Returns the index of the first visible column based on the scroll position. GetVisibleColumnsEnd Returns the index of the last visible column based on the scroll position. IsColumnVisible Returns True if the given column is currently visible (even if only partially visible) or False otherwise. OnGetColumnWidth This function must be overridden in the derived class, and should return the width of the given column in pixels. OnGetColumnsWidthHint This function doesn’t have to be overridden but it may be useful to do so if calculating the columns’ sizes is a relatively expensive operation as it gives your code a chance to calculate several of them at once and cache the result if necessary. RefreshColumn Triggers a refresh for just the given column’s area of the window if it’s visible. RefreshColumns Triggers a refresh for the area between the specified range of columns given (inclusively). ScrollColumnPages Scroll by the specified number of pages which may be positive (to scroll right) or negative (to scroll left). ScrollColumns Scroll by the specified number of columns which may be positive (to scroll right) or negative (to scroll left). ScrollToColumn Scroll to the specified column. SetColumnCount Set the number of columns the window contains.

## Class API¶

class wx.VarHScrollHelper(VarScrollHelperBase)

Possible constructors:

VarHScrollHelper(winToScroll)


This class provides functions wrapping the VarScrollHelperBase class, targeted for horizontal-specific scrolling.

### Methods¶

__init__(self, winToScroll)

Constructor taking the target window to be scrolled by this helper class.

This will attach scroll event handlers to the target window to catch and handle scroll events appropriately.

Parameters

winToScroll (wx.Window) –

EstimateTotalWidth(self)

This class forwards calls from EstimateTotalSize to this function so derived classes can override either just the height or the width estimation, or just estimate both differently if desired in any wx.HVScrolledWindow derived class.

Return type

wx.Coord

Note

This function will not be called if EstimateTotalSize is overridden in your derived class.

GetColumnCount(self)

Returns the number of columns the target window contains.

Return type

int

GetVisibleColumnsBegin(self)

Returns the index of the first visible column based on the scroll position.

Return type

int

GetVisibleColumnsEnd(self)

Returns the index of the last visible column based on the scroll position.

This includes the last column even if it is only partially visible.

Return type

int

IsColumnVisible(self, column)

Returns True if the given column is currently visible (even if only partially visible) or False otherwise.

Parameters

column (int) –

Return type

bool

OnGetColumnWidth(self, column)

This function must be overridden in the derived class, and should return the width of the given column in pixels.

Parameters

column (int) –

Return type

wx.Coord

OnGetColumnsWidthHint(self, columnMin, columnMax)

This function doesn’t have to be overridden but it may be useful to do so if calculating the columns’ sizes is a relatively expensive operation as it gives your code a chance to calculate several of them at once and cache the result if necessary.

OnGetColumnsWidthHint is normally called just before OnGetColumnWidth but you shouldn’t rely on the latter being called for all columns in the interval specified here. It is also possible that OnGetColumnWidth will be called for units outside of this interval, so this is really just a hint, not a promise.

Finally, note that columnMin is inclusive, while columnMax is exclusive.

Parameters
• columnMin (int) –

• columnMax (int) –

RefreshColumn(self, column)

Triggers a refresh for just the given column’s area of the window if it’s visible.

Parameters

column (int) –

RefreshColumns(self, from_, to_)

Triggers a refresh for the area between the specified range of columns given (inclusively).

Parameters
• from_ (int) –

• to_ (int) –

ScrollColumnPages(self, pages)

Scroll by the specified number of pages which may be positive (to scroll right) or negative (to scroll left).

Parameters

pages (int) –

Return type

bool

ScrollColumns(self, columns)

Scroll by the specified number of columns which may be positive (to scroll right) or negative (to scroll left).

Parameters

columns (int) –

Return type

bool

Returns

True if the window was scrolled, False otherwise (for example, if we’re trying to scroll right but we are already showing the last column).

ScrollToColumn(self, column)

Scroll to the specified column.

It will become the first visible column in the window.

Parameters

column (int) –

Return type

bool

Returns

True if we scrolled the window, False if nothing was done.

SetColumnCount(self, columnCount)

Set the number of columns the window contains.

The derived class must provide the widths for all columns with indices up to the one given here in it’s OnGetColumnWidth implementation.

Parameters

columnCount (int) –

### Properties¶

ColumnCount

VisibleColumnsBegin

VisibleColumnsEnd