Home | Trees | Index | Help |
|
---|
Package wx :: Class SearchCtrl |
|
object
--+ |Object
--+ |EvtHandler
--+ |Window
--+ |Control
--+ |TextCtrl
--+ | SearchCtrl
A search control is a composite of a wx.TextCtrl
with optional
bitmap buttons and a drop-down menu. Controls like this can typically
be found on a toolbar of applications that support some form of search
functionality. On the Mac this control is implemented using the
native HISearchField control, on the other platforms a generic control
is used, although that may change in the future as more platforms
introduce native search widgets.
If you wish to use a drop-down menu with your wx.SearchCtrl then you
will need to manage its content and handle the menu events yourself,
but this is an easy thing to do. Simply build the menu, pass it to
SetMenu
, and also bind a handler for a range of EVT_MENU events.
This gives you the flexibility to use the drop-down menu however you
wish, such as for a history of searches, or as a way to select
different kinds of searches. The ToolBar.py sample in the demo shows
one way to do this.
Since the control derives from wx.TextCtrl
it is convenient to use
the styles and events designed for wx.TextCtrl
. For example you can
use the wx.TE_PROCESS_ENTER style and catch the
wx.EVT_TEXT_ENTER event to know when the user has pressed the
Enter key in the control and wishes to start a search.
EVT_SEARCHCTRL_SEARCH_BTN Sent when the search icon is clicked EVT_SEARCHCTRL_CANCEL_BTN Sent when the cancel icon is clicked EVT_TEXT Sent when the text changes EVT_TEXT_ENTER Sent when the RETURN/ENTER key is pressed in the search control and the control has the wx.TE_PROCESS_ENTER style flag set.
Method Summary | |
---|---|
SearchCtrl |
A search control is a composite of a wx.TextCtrl with optional
bitmap buttons and a drop-down menu. |
bool |
Do the 2nd phase and create the GUI control. |
String |
Get the text to be displayed when the user has not yet typed anything in the control. |
Menu |
Returns a pointer to the search control's menu object or None if there is no menu attached. |
bool |
Indicates whether the cancel button is visible. |
bool |
Returns the search button visibility value. |
Sets the bitmap to use for the cancel button. | |
Set the text to be displayed when the user has not yet typed anything in the control. | |
Sets the search control's menu object. | |
Sets the bitmap to use for the search button. | |
Sets the bitmap to use for the search button when there is a drop-down menu associated with the search control. | |
Shows or hides the cancel button. | |
Sets the search button visibility value on the search control. |
Property Summary | |
---|---|
CancelButtonVisible | |
DescriptiveText | |
Menu | |
SearchButtonVisible | |
thisown : The membership flag |
Instance Method Details |
---|
__init__(self,
parent,
id=-1,
value=wxEmptyString,
pos=DefaultPosition,
size=DefaultSize,
style=0,
validator=DefaultValidator,
name=SearchCtrlNameStr)
|
EVT_SEARCHCTRL_SEARCH_BTN | Sent when the search icon is clicked |
EVT_SEARCHCTRL_CANCEL_BTN | Sent when the cancel icon is clicked |
EVT_TEXT | Sent when the text changes |
EVT_TEXT_ENTER | Sent when the RETURN/ENTER key is pressed in the search control and the control has the wx.TE_PROCESS_ENTER style flag set. |
parent
id
value
pos
size
style
validator
name
wx.TextCtrl.__init__
Create(self, parent, id=-1, value=wxEmptyString, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=SearchCtrlNameStr)Do the 2nd phase and create the GUI control.
|
GetDescriptiveText(self)Get the text to be displayed when the user has not yet typed anything in the control.
|
GetMenu(self)Returns a pointer to the search control's menu object or None if there is no menu attached.
|
IsCancelButtonVisible(self)Indicates whether the cancel button is visible.
|
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
|
SetCancelBitmap(self, bitmap)Sets the bitmap to use for the cancel button. This currently does not work on the Mac.
|
SetDescriptiveText(self, text)Set the text to be displayed when the user has not yet typed anything in the control.
|
SetMenu(self, menu)Sets the search control's menu object. If there is already a menu associated with the search control it is deleted.
|
SetSearchBitmap(self, bitmap)Sets the bitmap to use for the search button. This currently does not work on the Mac.
|
SetSearchMenuBitmap(self, bitmap)Sets the bitmap to use for the search button when there is a drop-down menu associated with the search control. This currently does not work on the Mac.
|
ShowCancelButton(self, show)Shows or hides the cancel button.
|
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
|
Property Details |
---|
CancelButtonVisible
|
DescriptiveText
|
Menu |
SearchButtonVisible
|
thisownThe membership flag |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:14:15 2007 | http://epydoc.sf.net |