Maintainer | gtk2hs-users@lists.sourceforge.net |
---|---|
Stability | provisional |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
A single line text entry field
- data Entry
- class WidgetClass o => EntryClass o
- castToEntry :: GObjectClass obj => obj -> Entry
- gTypeEntry :: GType
- toEntry :: EntryClass o => o -> Entry
- entryNew :: IO Entry
- entryNewWithBuffer :: EntryBufferClass buffer => buffer -> IO Entry
- entrySetText :: (EntryClass self, GlibString string) => self -> string -> IO ()
- entryGetText :: (EntryClass self, GlibString string) => self -> IO string
- entryAppendText :: (EntryClass self, GlibString string) => self -> string -> IO ()
- entryPrependText :: (EntryClass self, GlibString string) => self -> string -> IO ()
- entrySetVisibility :: EntryClass self => self -> Bool -> IO ()
- entryGetVisibility :: EntryClass self => self -> IO Bool
- entrySetInvisibleChar :: EntryClass self => self -> Char -> IO ()
- entryGetInvisibleChar :: EntryClass self => self -> IO Char
- entrySetMaxLength :: EntryClass self => self -> Int -> IO ()
- entryGetMaxLength :: EntryClass self => self -> IO Int
- entryGetActivatesDefault :: EntryClass self => self -> IO Bool
- entrySetActivatesDefault :: EntryClass self => self -> Bool -> IO ()
- entryGetHasFrame :: EntryClass self => self -> IO Bool
- entrySetHasFrame :: EntryClass self => self -> Bool -> IO ()
- entryGetWidthChars :: EntryClass self => self -> IO Int
- entrySetWidthChars :: EntryClass self => self -> Int -> IO ()
- entrySetAlignment :: EntryClass self => self -> Float -> IO ()
- entryGetAlignment :: EntryClass self => self -> IO Float
- entrySetCompletion :: EntryClass self => self -> EntryCompletion -> IO ()
- entryGetCompletion :: EntryClass self => self -> IO EntryCompletion
- entryGetBuffer :: EntryClass self => self -> IO EntryBuffer
- entrySetBuffer :: (EntryClass self, EntryBufferClass buffer) => self -> buffer -> IO ()
- entryGetIconWindow :: EntryClass self => self -> EntryIconPosition -> IO DrawWindow
- entryGetTextWindow :: EntryClass self => self -> IO DrawWindow
- entryImContextFilterKeypress :: EntryClass self => self -> EventM EKey Bool
- entryResetImContext :: EntryClass self => self -> IO ()
- entryCursorPosition :: EntryClass self => ReadAttr self Int
- entrySelectionBound :: EntryClass self => ReadAttr self Int
- entryEditable :: EntryClass self => Attr self Bool
- entryMaxLength :: EntryClass self => Attr self Int
- entryVisibility :: EntryClass self => Attr self Bool
- entryHasFrame :: EntryClass self => Attr self Bool
- entryInvisibleChar :: EntryClass self => Attr self Char
- entryActivatesDefault :: EntryClass self => Attr self Bool
- entryWidthChars :: EntryClass self => Attr self Int
- entryScrollOffset :: EntryClass self => ReadAttr self Int
- entryText :: (EntryClass self, GlibString string) => Attr self string
- entryXalign :: EntryClass self => Attr self Float
- entryAlignment :: EntryClass self => Attr self Float
- entryCompletion :: EntryClass self => Attr self EntryCompletion
- entryBuffer :: (EntryClass self, EntryBufferClass buffer) => ReadWriteAttr self EntryBuffer buffer
- entryActivated :: EntryClass ec => Signal ec (IO ())
- entryActivate :: EntryClass ec => Signal ec (IO ())
- entryBackspace :: EntryClass ec => Signal ec (IO ())
- entryCopyClipboard :: EntryClass ec => Signal ec (IO ())
- entryCutClipboard :: EntryClass ec => Signal ec (IO ())
- entryPasteClipboard :: EntryClass ec => Signal ec (IO ())
- entryDeleteFromCursor :: EntryClass ec => Signal ec (DeleteType -> Int -> IO ())
- entryInsertAtCursor :: (EntryClass ec, GlibString string) => Signal ec (string -> IO ())
- entryMoveCursor :: EntryClass ec => Signal ec (MovementStep -> Int -> Bool -> IO ())
- entryPopulatePopup :: EntryClass ec => Signal ec (Menu -> IO ())
- entryToggleOverwirte :: EntryClass ec => Signal ec (IO ())
- entryPreeditChanged :: (EntryClass ec, GlibString string) => Signal ec (string -> IO ())
- entryIconPress :: EntryClass ec => Signal ec (EntryIconPosition -> EventM EButton ())
- entryIconRelease :: EntryClass ec => Signal ec (EntryIconPosition -> EventM EButton ())
- onEntryActivate :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- afterEntryActivate :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- onCopyClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- afterCopyClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- onCutClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- afterCutClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- onPasteClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- afterPasteClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- onToggleOverwrite :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
- afterToggleOverwrite :: EntryClass ec => ec -> IO () -> IO (ConnectId ec)
Detail
The Entry
widget is a single line text entry widget. A fairly large set
of key bindings are supported by default. If the entered text is longer than
the allocation of the widget, the widget will scroll so that the cursor
position is visible.
Class Hierarchy
|GObject
| +----Object
| +----Widget
| +----Entry | +----SpinButton
Types
class WidgetClass o => EntryClass o Source
castToEntry :: GObjectClass obj => obj -> Entry Source
toEntry :: EntryClass o => o -> Entry Source
Constructors
entryNewWithBuffer :: EntryBufferClass buffer => buffer -> IO Entry Source
Creates a new Entry
widget backed by a particular EntryBuffer
. One
buffer can be shared among many widgets.
Methods
entrySetText :: (EntryClass self, GlibString string) => self -> string -> IO () Source
Sets the text in the widget to the given value, replacing the current contents.
entryGetText :: (EntryClass self, GlibString string) => self -> IO string Source
Retrieves the contents of the entry widget.
See also editableGetChars
.
entryAppendText :: (EntryClass self, GlibString string) => self -> string -> IO () Source
Appends the given text to the contents of the widget.
- Warning: this function is deprecated and should not be used in newly-written code.
Removed in Gtk3.
entryPrependText :: (EntryClass self, GlibString string) => self -> string -> IO () Source
Prepends the given text to the contents of the widget.
- Warning: this function is deprecated and should not be used in newly-written code.
Removed in Gtk3.
:: EntryClass self | |
=> self | |
-> Bool |
|
-> IO () |
Sets whether the contents of the entry are visible or not. When
visibility is set to False
, characters are displayed as the invisible
char, and will also appear that way when the text in the entry widget is
copied elsewhere.
The default invisible char is the asterisk '*', but it can be changed
with entrySetInvisibleChar
.
:: EntryClass self | |
=> self | |
-> IO Bool | returns |
Retrieves whether the text in entry
is visible. See
entrySetVisibility
.
entrySetInvisibleChar :: EntryClass self => self -> Char -> IO () Source
Sets the character to use in place of the actual text when
entrySetVisibility
has been called to set text visibility to False
. i.e.
this is the character used in "password mode" to show the user how many
characters have been typed. The default invisible char is an asterisk
('*'). If you set the invisible char to '\0'
, then the user will get
no feedback at all; there will be no text on the screen as they type.
:: EntryClass self | |
=> self | |
-> IO Char | returns the current invisible char, or |
Retrieves the character displayed in place of the real characters for
entries with visisbility set to false. See entrySetInvisibleChar
.
:: EntryClass self | |
=> self | |
-> Int |
|
-> IO () |
Sets the maximum allowed length of the contents of the widget. If the current contents are longer than the given length, then they will be truncated to fit.
:: EntryClass self | |
=> self | |
-> IO Int | returns the maximum allowed number of characters in |
Retrieves the maximum allowed length of the text in entry
. See
entrySetMaxLength
.
entryGetActivatesDefault Source
:: EntryClass self | |
=> self | |
-> IO Bool | returns |
Query whether pressing return will activate the default widget.
entrySetActivatesDefault Source
:: EntryClass self | |
=> self | |
-> Bool |
|
-> IO () |
If setting
is True
, pressing Enter in the entry
will activate the
default widget for the window containing the entry. This usually means that
the dialog box containing the entry will be closed, since the default widget
is usually one of the dialog buttons.
(For experts: if setting
is True
, the entry calls
windowActivateDefault
on the window
containing the entry, in the default
handler for the "activate" signal.)
This setting is useful in Dialog
boxes where enter should press the
default button.
:: EntryClass self | |
=> self | |
-> IO Bool | returns whether the entry has a beveled frame |
Query if the text Entry
is displayed with a frame around it.
entrySetHasFrame :: EntryClass self => self -> Bool -> IO () Source
Sets whether the entry has a beveled frame around it.
:: EntryClass self | |
=> self | |
-> IO Int | returns number of chars to request space for, or negative if unset |
Gets the value set by entrySetWidthChars
.
:: EntryClass self | |
=> self | |
-> Int |
|
-> IO () |
Changes the size request of the entry to be about the right size for
nChars
characters. Note that it changes the size request, the size can
still be affected by how you pack the widget into containers. If nChars
is
-1, the size reverts to the default entry size.
This setting is only considered when the widget formulates its size request. Make sure that it is not mapped (shown) before you change this value.
:: EntryClass self | |
=> self | |
-> Float |
|
-> IO () |
Sets the alignment for the contents of the entry. This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.
- Available since Gtk version 2.4
:: EntryClass self | |
=> self | |
-> IO Float | returns the alignment |
Gets the value set by entrySetAlignment
.
- Available since Gtk version 2.4
entrySetCompletion :: EntryClass self => self -> EntryCompletion -> IO () Source
Sets the auxiliary completion object to use with the entry. All further
configuration of the completion mechanism is done on completion using the
EntryCompletion
API.
- Available since Gtk version 2.4
:: EntryClass self | |
=> self | |
-> IO EntryCompletion | returns The auxiliary completion object currently
in use by |
Returns the auxiliary completion object currently in use by the entry.
- Available since Gtk version 2.4
entryGetBuffer :: EntryClass self => self -> IO EntryBuffer Source
Get the EntryBuffer
object which holds the text for this widget.
entrySetBuffer :: (EntryClass self, EntryBufferClass buffer) => self -> buffer -> IO () Source
Set the EntryBuffer
object which holds the text for this widget.
:: EntryClass self | |
=> self | |
-> EntryIconPosition |
|
-> IO DrawWindow | returns the entry's icon window at |
Returns the Window
which contains the entry's icon at iconPos
. This function is useful when
drawing something to the entry in an eventExpose
callback because it enables the callback to
distinguish between the text window and entry's icon windows.
See also entryGetTextWindow
.
Removed in Gtk3.
:: EntryClass self | |
=> self | |
-> IO DrawWindow | returns the entry's text window. |
Returns the Window
which contains the text. This function is useful when drawing something to the
entry in an eventExpose
callback because it enables the callback to distinguish between the text
window and entry's icon windows.
See also entryGetIconWindow
.
Removed in Gtk3.
entryImContextFilterKeypress :: EntryClass self => self -> EventM EKey Bool Source
Allow the Entry
input method to internally handle key press and release events. If this function
returns True
, then no further processing should be done for this key event. See
imContextFilterKeypress
.
Note that you are expected to call this function from your handler when overriding key event
handling. This is needed in the case when you need to insert your own key handling between the input
method and the default key event handling of the Entry
. See textViewResetImContext
for
an example of use.
- Available since Gtk+ version 2.22
entryResetImContext :: EntryClass self => self -> IO () Source
Reset the input method context of the entry if needed.
This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.
- Available since Gtk+ version 2.22
Attributes
entryCursorPosition :: EntryClass self => ReadAttr self Int Source
The current position of the insertion cursor in chars.
Allowed values: [0,65535]
Default value: 0
entrySelectionBound :: EntryClass self => ReadAttr self Int Source
The position of the opposite end of the selection from the cursor in chars.
Allowed values: [0,65535]
Default value: 0
entryEditable :: EntryClass self => Attr self Bool Source
Whether the entry contents can be edited.
Default value: True
entryMaxLength :: EntryClass self => Attr self Int Source
Maximum number of characters for this entry. Zero if no maximum.
Allowed values: [0,65535]
Default value: 0
entryVisibility :: EntryClass self => Attr self Bool Source
False
displays the "invisible char" instead of the actual text
(password mode).
Default value: True
entryHasFrame :: EntryClass self => Attr self Bool Source
False
removes outside bevel from entry.
Default value: True
entryInvisibleChar :: EntryClass self => Attr self Char Source
The character to use when masking entry contents (in "password mode").
Default value: '*'
entryActivatesDefault :: EntryClass self => Attr self Bool Source
Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed.
Default value: False
entryWidthChars :: EntryClass self => Attr self Int Source
Number of characters to leave space for in the entry.
Allowed values: >= -1
Default value: -1
entryScrollOffset :: EntryClass self => ReadAttr self Int Source
Number of pixels of the entry scrolled off the screen to the left.
Allowed values: >= 0
Default value: 0
entryText :: (EntryClass self, GlibString string) => Attr self string Source
The contents of the entry.
Default value: ""
entryXalign :: EntryClass self => Attr self Float Source
The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts.
Allowed values: [0,1]
Default value: 0
entryAlignment :: EntryClass self => Attr self Float Source
'alignment' property. See entryGetAlignment
and entrySetAlignment
entryCompletion :: EntryClass self => Attr self EntryCompletion Source
'completion' property. See entryGetCompletion
and
entrySetCompletion
entryBuffer :: (EntryClass self, EntryBufferClass buffer) => ReadWriteAttr self EntryBuffer buffer Source
The buffer being displayed.
Signals
entryActivated :: EntryClass ec => Signal ec (IO ()) Source
A keybinding signal which gets emitted when the user activates the entry.
Applications should not connect to it, but may emit it with signalEmitByName
if they need to
control activation programmatically.
entryActivate :: EntryClass ec => Signal ec (IO ()) Source
Deprecated. See entryActivated
.
entryBackspace :: EntryClass ec => Signal ec (IO ()) Source
The entryBackspace
signal is a keybinding signal which gets emitted when the user asks for it.
The default bindings for this signal are Backspace and Shift-Backspace.
entryCopyClipboard :: EntryClass ec => Signal ec (IO ()) Source
The entryCopyClipboard
signal is a keybinding signal which gets emitted to copy the selection to the
clipboard.
The default bindings for this signal are Ctrl-c and Ctrl-Insert.
entryCutClipboard :: EntryClass ec => Signal ec (IO ()) Source
The entryCutClipboard
signal is a keybinding signal which gets emitted to cut the selection to the
clipboard.
The default bindings for this signal are Ctrl-x and Shift-Delete.
entryPasteClipboard :: EntryClass ec => Signal ec (IO ()) Source
The entryPasteClipboard
signal is a keybinding signal which gets emitted to paste the contents of the
clipboard into the text view.
The default bindings for this signal are Ctrl-v and Shift-Insert.
entryDeleteFromCursor :: EntryClass ec => Signal ec (DeleteType -> Int -> IO ()) Source
The entryDeleteFromCursor
signal is a keybinding signal which gets emitted when the user initiates a
text deletion.
If the type is DeleteChars
, GTK+ deletes the selection if there is one, otherwise it deletes
the requested number of characters.
The default bindings for this signal are Delete for deleting a character and Ctrl-Delete for deleting a word.
entryInsertAtCursor :: (EntryClass ec, GlibString string) => Signal ec (string -> IO ()) Source
The entryInsertAtCursor
signal is a keybinding signal which gets emitted when the user initiates the
insertion of a fixed string at the cursor.
entryMoveCursor :: EntryClass ec => Signal ec (MovementStep -> Int -> Bool -> IO ()) Source
The entryMoveCursor
signal is a keybinding signal which gets emitted when the user initiates a cursor
movement. If the cursor is not visible in entry, this signal causes the viewport to be moved
instead.
Applications should not connect to it, but may emit it with signalEmitByName
if they need to
control the cursor programmatically.
The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here.
- Arrow keys move by individual characters/lines
- Ctrl-arrow key combinations move by words/paragraphs
- Home/End keys move to the ends of the buffer
entryPopulatePopup :: EntryClass ec => Signal ec (Menu -> IO ()) Source
The entryPopulatePopup
signal gets emitted before showing the context menu of the entry.
If you need to add items to the context menu, connect to this signal and append your menuitems to the menu.
entryToggleOverwirte :: EntryClass ec => Signal ec (IO ()) Source
The entryToggleOverwrite
signal is a keybinding signal which gets emitted to toggle the overwrite mode
of the entry.
The default bindings for this signal is Insert.
entryPreeditChanged :: (EntryClass ec, GlibString string) => Signal ec (string -> IO ()) Source
If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.
entryIconPress :: EntryClass ec => Signal ec (EntryIconPosition -> EventM EButton ()) Source
The iconPress
signal is emitted when an activatable icon is clicked.
entryIconRelease :: EntryClass ec => Signal ec (EntryIconPosition -> EventM EButton ()) Source
The iconRelease
signal is emitted on the button release from a mouse click over an activatable
icon.
Deprecated
onEntryActivate :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the user presses return within
the Entry
field.
afterEntryActivate :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the user presses return within
the Entry
field.
onCopyClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the current selection has been copied to the clipboard.
afterCopyClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the current selection has been copied to the clipboard.
onCutClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the current selection has been cut to the clipboard.
afterCutClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the current selection has been cut to the clipboard.
onPasteClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the current selection has been pasted from the clipboard.
afterPasteClipboard :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the current selection has been pasted from the clipboard.
onToggleOverwrite :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the user changes from overwriting to inserting.
afterToggleOverwrite :: EntryClass ec => ec -> IO () -> IO (ConnectId ec) Source
Emitted when the user changes from overwriting to inserting.