Table Of Contents

Previous topic

Scrolled

Next topic

SeekMode

This Page

phoenix_title SearchCtrl

A search control is a composite control with a search button, a text control, and a cancel button.

styles Window Styles

This class supports the following styles:

  • TE_PROCESS_ENTER: The control will generate the event wxEVT_COMMAND_TEXT_ENTER (otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls).
  • TE_PROCESS_TAB: The control will receive wxEVT_CHAR events for TAB pressed - normally, TAB is used for passing to the next control in a dialog instead. For the control created with this style, you can still use Ctrl-Enter to pass to the next control from the keyboard.
  • TE_NOHIDESEL: By default, the Windows text control doesn’t show the selection when it doesn’t have focus - use this style to force it to always show it. It doesn’t do anything under other platforms.
  • TE_LEFT: The text in the control will be left-justified (default).
  • TE_CENTRE: The text in the control will be centered (currently wxMSW and wxGTK2 only).
  • TE_RIGHT: The text in the control will be right-justified (currently wxMSW and wxGTK2 only).
  • TE_CAPITALIZE: On PocketPC and Smartphone, causes the first letter to be capitalized.

events Events Emitted by this Class

Handlers bound for the following event types will receive one of the CommandEvent TextCtrl. parameters.

  • EVT_SEARCHCTRL_SEARCH_BTN: Respond to a wxEVT_SEARCHCTRL_SEARCH_BTN event, generated when the search button is clicked. Note that this does not initiate a search on its own, you need to perform the appropriate action in your event handler. You may use

    event.GetString()
    

to retrieve the string to search for in the event handler code. - EVT_SEARCHCTRL_CANCEL_BTN: Respond to a wxEVT_SEARCHCTRL_CANCEL_BTN event, generated when the cancel button is clicked.


class_hierarchy Inheritance Diagram

Inheritance diagram for class SearchCtrl

Inheritance diagram of SearchCtrl


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__ Default constructor.
Create Creates the text control for two-step construction.
GetDescriptiveText Return the text displayed when there is not yet any user input.
GetMenu Returns a pointer to the search control’s menu object or None if there is no menu attached.
IsCancelButtonVisible Returns the cancel button’s visibility state.
IsSearchButtonVisible Returns the search button visibility value.
SetCancelBitmap  
SetDescriptiveText Set the text to be displayed in the search control when the user has not yet typed anything in it.
SetMenu Sets the search control’s menu object.
SetSearchBitmap  
SetSearchMenuBitmap  
ShowCancelButton Shows or hides the cancel button.
ShowSearchButton Sets the search button visibility value on the search control.

api Class API



class SearchCtrl(TextCtrl)

A search control is a composite control with a search button, a text control, and a cancel button.

Possible constructors:

SearchCtrl()

SearchCtrl(parent, id=ID_ANY, value='', pos=DefaultPosition,
           size=DefaultSize, style=0, validator=DefaultValidator,
           name=SearchCtrlNameStr)

Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.



__init__ (self, parent, id=ID_ANY, value=’‘, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=SearchCtrlNameStr)

Constructor, creating and showing a text control.

Parameters:
  • parent (Window) – Parent window. Should not be None.
  • id (int) – Control identifier. A value of -1 denotes a default value.
  • value (string) – Default text value.
  • pos (Point) – Text control position.
  • size (Size) – Text control size.
  • style (long) – Window style. See SearchCtrl.
  • validator (Validator) – Window validator.
  • name (string) – Window name.





Create(self, parent, id=ID_ANY, value='', pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=SearchCtrlNameStr)

Creates the text control for two-step construction.

This method should be called if the default constructor was used for the control creation. Its parameters have the same meaning as for the non-default constructor.

Parameters:
  • parent (Window) –
  • id (int) –
  • value (string) –
  • pos (Point) –
  • size (Size) –
  • style (long) –
  • validator (Validator) –
  • name (string) –
Return type:

bool



GetDescriptiveText(self)

Return the text displayed when there is not yet any user input.

Return type:string


GetMenu(self)

Returns a pointer to the search control’s menu object or None if there is no menu attached.

Return type: Menu


IsCancelButtonVisible(self)

Returns the cancel button’s visibility state.

Return type:bool


IsSearchButtonVisible(self)

Returns the search button visibility value.

If there is a menu attached, the search button will be visible regardless of the search button visibility value.

This always returns False in Mac OS X v10.3

Return type:bool


SetCancelBitmap(self, bmp)


SetDescriptiveText(self, text)

Set the text to be displayed in the search control when the user has not yet typed anything in it.

Parameters:text (string) –


SetMenu(self, menu)

Sets the search control’s menu object.

If there is already a menu associated with the search control it is deleted.

Parameters:menu (Menu) – Menu to attach to the search control.


SetSearchBitmap(self, bmp)


SetSearchMenuBitmap(self, bmp)


ShowCancelButton(self, show)

Shows or hides the cancel button.

Parameters:show (bool) –


ShowSearchButton(self, show)

Sets the search button visibility value on the search control.

If there is a menu attached, the search button will be visible regardless of the search button visibility value.

This has no effect in Mac OS X v10.3

Parameters:show (bool) –

Properties



CancelButtonVisible

See IsCancelButtonVisible and ShowCancelButton



DescriptiveText

See GetDescriptiveText and SetDescriptiveText



Menu

See GetMenu and SetMenu



SearchButtonVisible

See IsSearchButtonVisible and ShowSearchButton