Table Of Contents

Previous topic

PenStyle

Next topic

PlatformInfo

This Page

phoenix_title PickerBase

Base abstract class for all pickers which support an auxiliary text control.

This class handles all positioning and sizing of the text control like a an horizontal BoxSizer would do, with the text control on the left of the picker button.

The proportion (see Sizer documentation for more info about proportion values) of the picker control defaults to 1 when there isn’t a text control associated (see PB_USE_TEXTCTRL style) and to 0 otherwise.

styles Window Styles

This class supports the following styles:

  • PB_USE_TEXTCTRL: Creates a text control to the left of the picker which is completely managed by this PickerBase class.

class_hierarchy Inheritance Diagram

Inheritance diagram for class PickerBase

Inheritance diagram of PickerBase


method_summary Methods Summary

__init__  
CreateBase  
GetInternalMargin Returns the margin (in pixel) between the picker and the text control.
GetPickerCtrl Returns the native implementation of the real picker control.
GetPickerCtrlProportion Returns the proportion value of the picker.
GetPickerStyle  
GetTextCtrl Returns a pointer to the text control handled by this window or None if the PB_USE_TEXTCTRL style was not specified when this control was created.
GetTextCtrlProportion Returns the proportion value of the text control.
GetTextCtrlStyle  
HasTextCtrl Returns True if this window has a valid text control (i.e.
IsPickerCtrlGrowable Returns True if the picker control is growable.
IsTextCtrlGrowable Returns True if the text control is growable.
PostCreation  
SetInternalMargin Sets the margin (in pixel) between the picker and the text control.
SetPickerCtrl  
SetPickerCtrlGrowable Sets the picker control as growable when grow is True.
SetPickerCtrlProportion Sets the proportion value of the picker.
SetTextCtrl  
SetTextCtrlGrowable Sets the text control as growable when grow is True.
SetTextCtrlProportion Sets the proportion value of the text control.
UpdatePickerFromTextCtrl  
UpdateTextCtrlFromPicker  

api Class API



class PickerBase(Control)

Base abstract class for all pickers which support an auxiliary text control.

Possible constructors:

PickerBase()

Methods



__init__(self)


CreateBase(self, parent, id=ID_ANY, text='', pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=ButtonNameStr)
Parameters:
  • parent (Window) –
  • id (int) –
  • text (string) –
  • pos (Point) –
  • size (Size) –
  • style (long) –
  • validator (Validator) –
  • name (string) –
Return type:

bool



GetInternalMargin(self)

Returns the margin (in pixel) between the picker and the text control.

This function can be used only when HasTextCtrl returns True.

Return type:int


GetPickerCtrl(self)

Returns the native implementation of the real picker control.

Return type: Control

Note

The returned control in the generic implementation of FilePickerCtrl, DirPickerCtrl, FontPickerCtrl and ColourPickerCtrl is a specialized Button class so that you can change its label doing, e.g.:

if wx.Platform == '__WXMSW__':
    # wxMSW is one of the platforms where the generic implementation
    # of wx.FilePickerCtrl is used...

    pButt = myFilePickerCtrl.GetPickerCtrl()

    if pButt is not None:
        pButt.SetLabel('Custom browse string')


GetPickerCtrlProportion(self)

Returns the proportion value of the picker.

Return type:int


GetPickerStyle(self, style)
Parameters:style (long) –
Return type:long


GetTextCtrl(self)

Returns a pointer to the text control handled by this window or None if the PB_USE_TEXTCTRL style was not specified when this control was created.

Return type: TextCtrl

Note

The contents of the text control could be an invalid representation of the entity which can be chosen through the picker (e.g. when the user enters an invalid colour syntax because of a typo). Thus you should never parse the content of the textctrl to get the user’s input; rather use the derived-class getter (e.g. ColourPickerCtrl.GetColour , FilePickerCtrl.GetPath , etc).



GetTextCtrlProportion(self)

Returns the proportion value of the text control.

This function can be used only when HasTextCtrl returns True.

Return type:int


GetTextCtrlStyle(self, style)
Parameters:style (long) –
Return type:long


HasTextCtrl(self)

Returns True if this window has a valid text control (i.e.

if the PB_USE_TEXTCTRL style was given when creating this control).

Return type:bool


IsPickerCtrlGrowable(self)

Returns True if the picker control is growable.

Return type:bool


IsTextCtrlGrowable(self)

Returns True if the text control is growable.

This function can be used only when HasTextCtrl returns True.

Return type:bool


PostCreation(self)


SetInternalMargin(self, margin)

Sets the margin (in pixel) between the picker and the text control.

This function can be used only when HasTextCtrl returns True.

Parameters:margin (int) –


SetPickerCtrl(self, picker)
Parameters:picker (Control) –


SetPickerCtrlGrowable(self, grow=True)

Sets the picker control as growable when grow is True.

Parameters:grow (bool) –


SetPickerCtrlProportion(self, prop)

Sets the proportion value of the picker.

Look at the detailed description of PickerBase for more info.

Parameters:prop (int) –


SetTextCtrl(self, text)
Parameters:text (TextCtrl) –


SetTextCtrlGrowable(self, grow=True)

Sets the text control as growable when grow is True.

This function can be used only when HasTextCtrl returns True.

Parameters:grow (bool) –


SetTextCtrlProportion(self, prop)

Sets the proportion value of the text control.

Look at the detailed description of PickerBase for more info.

This function can be used only when HasTextCtrl returns True.

Parameters:prop (int) –


UpdatePickerFromTextCtrl(self)


UpdateTextCtrlFromPicker(self)

Properties



InternalMargin

See GetInternalMargin and SetInternalMargin



PickerCtrl

See GetPickerCtrl and SetPickerCtrl



PickerCtrlProportion

See GetPickerCtrlProportion and SetPickerCtrlProportion



TextCtrl

See GetTextCtrl and SetTextCtrl



TextCtrlProportion

See GetTextCtrlProportion and SetTextCtrlProportion