public class Entry extends Widget implements Editable, CellEditable
Modifier and Type | Class and Description |
---|---|
static interface |
Entry.Activate
The
Entry.Activate signal occurs when the user presses
Enter or Return in an Entry. |
static interface |
Entry.Changed
The signal emitted when the text in the Entry has changed.
|
static interface |
Entry.IconPress
Emitted when an activatable icon is clicked.
|
static interface |
Entry.IconRelease
Emitted on the button release from a mouse click over an activatable
icon.
|
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
Constructor and Description |
---|
Entry()
Construct a new Entry
|
Entry(String text)
Construct a new Entry, initialized with the specified text
|
Modifier and Type | Method and Description |
---|---|
void |
connect(Editable.Changed handler)
Connect a
Editable.Changed handler. |
void |
connect(Entry.Activate handler)
Connects an
Entry.Activate handler to the Widget. |
void |
connect(Entry.Changed handler)
Connect a
Entry.Changed handler. |
void |
connect(Entry.IconPress handler)
Hook up the
Entry.IconPress handler. |
void |
connect(Entry.IconRelease handler)
Hook up the
Entry.IconRelease handler. |
EntryCompletion |
getCompletion()
Returns the current
EntryCompletion object which is currently
used by the Entry . |
boolean |
getIconActivatable(EntryIconPosition position)
Return
true if the icon at the given position
is activatable. |
int |
getIconAtPos(int x,
int y)
Find the icon at the given position and return its index.
|
Icon |
getIconIcon(EntryIconPosition position)
Retrieves the named Icon used for illustrating icon at
position on this Entry. |
Pixbuf |
getIconPixbuf(EntryIconPosition position)
Retrieves the image used for the icon as a
Pixbuf . |
boolean |
getIconSensitive(EntryIconPosition position)
Return
true if the icon at the given position
is sensitive. |
Stock |
getIconStock(EntryIconPosition position)
Retrieves the image used for the icon as a
Stock item. |
ImageType |
getIconStorageType(EntryIconPosition position)
Get the type used by the icon to store image data.
|
String |
getIconTooltipMarkup(EntryIconPosition position)
Return the note that is displayed when the mouse pointer is over the
icon.
|
String |
getIconTooltipText(EntryIconPosition position)
Return the note that is displayed when the mouse pointer is over the
icon.
|
int |
getMaxLength()
Returns the current maximum width, in characters, the text in the Entry
is allowed to be.
|
boolean |
getOverwriteMode()
Get the value previously set with
setOverwriteMode() . |
int |
getPosition()
Retrieves the current cursor position.
|
double |
getProgressFraction()
Get the current progress fraction of the
Entry . |
double |
getProgressPulseStep()
Get the current progress pulse step of the
Entry . |
int |
getSelectionBoundsEnd()
Retrieves the selection end position of the Editable.
|
int |
getSelectionBoundsStart()
Retrieves the selection start position of the Editable.
|
String |
getText()
Get the text currently showing in the Entry.
|
char |
getTextLength()
Get the length of the text currently showing in the Entry.
|
boolean |
getVisibility()
Is text in the Entry are visible, or hidden by an obscuring character?
|
void |
progressPulse()
Cause the
Entry 's progress indicator to enter
"activity mode", used to indicate that the application is
making progress but in a way that can't be strictly quantized. |
void |
selectRegion(int start,
int end)
Select a region of the text in this Editable.
|
void |
setAlignment(float xalign)
Set the alignment of the the text being displayed in the Entry.
|
void |
setCompletion(EntryCompletion completion)
Set the completion object to use with this Entry.
|
void |
setEditable(boolean editable)
Set whether the text in the Entry can be change by the user.
|
void |
setHasFrame(boolean setting)
Set whether the Entry has a bevelled frame around it or not.
|
void |
setIconActivatable(EntryIconPosition position,
boolean setting)
Set whether the icon at the given
position is activatable
or not. |
void |
setIconFromIcon(EntryIconPosition position,
Icon icon)
Cause the Entry to have an icon at the given
position
using an Icon from the current icon theme. |
void |
setIconFromPixbuf(EntryIconPosition position,
Pixbuf pixbuf)
Set the icon to a given
position using a Pixbuf . |
void |
setIconFromStock(EntryIconPosition position,
Stock stock)
Set the icon to a given
position using a Stock
item. |
void |
setIconSensitive(EntryIconPosition position,
boolean setting)
Set whether the icon at the given
position should be
sensitive or insensitive. |
void |
setIconTooltipMarkup(EntryIconPosition position,
String markup)
Set the note (with Pango markup) that will be displayed when the mouse
pointer will be over the icon.
|
void |
setIconTooltipText(EntryIconPosition position,
String text)
Set the note (without Pango markup) that will be displayed when the
mouse pointer will be over the icon.
|
void |
setInnerBorder(int left,
int right,
int top,
int bottom)
Set the padding between the text entry control itself, and the
surrounding decoration.
|
void |
setInvisibleChar(char replacement)
Change the character used to obscure text when
visibility is false . |
void |
setMaxLength(int max)
Specify the maximum number of characters the user is allowed to enter.
|
void |
setOverwriteMode(boolean setting)
Set whether the text should be overwritten when typing in the Entry.
|
void |
setPosition(int position)
Set the position of the cursor in this Editable.
|
void |
setProgressFraction(double fraction)
Set the fraction of the progress that shows the
Entry as
"filled-in". |
void |
setProgressPulseStep(double fraction)
Set the progress pulse step of the
Entry . |
void |
setText(String text)
Replace the current contents of the Entry with the supplied text.
|
void |
setVisibility(boolean setting)
Set whether the text in the entry is visible or obscured.
|
void |
setWidthChars(int width)
Request that the width of this Entry be wide enough for a given number
of characters.
|
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public Entry()
public Entry(String text)
public void connect(Editable.Changed handler)
Editable.Changed
handler. Use
connect(Entry.Changed)
instead, as it saves you having to cast the source
parameter.public void connect(Entry.Activate handler)
Entry.Activate
handler to the Widget.public void connect(Entry.Changed handler)
Entry.Changed
handler.public void connect(Entry.IconPress handler)
Entry.IconPress
handler.public void connect(Entry.IconRelease handler)
Entry.IconRelease
handler.public EntryCompletion getCompletion()
EntryCompletion
object which is currently
used by the Entry
.public boolean getIconActivatable(EntryIconPosition position)
true
if the icon at the given position
is activatable.public int getIconAtPos(int x, int y)
If x
or y
are not inside an icon,
-1
will be returned.
public Icon getIconIcon(EntryIconPosition position)
position
on this Entry.
A null
value will be returned if the icon was not set from
an named Icon.
public Pixbuf getIconPixbuf(EntryIconPosition position)
Pixbuf
.
A null
value will be returned if no icon is set for this
position
.
public boolean getIconSensitive(EntryIconPosition position)
true
if the icon at the given position
is sensitive.public Stock getIconStock(EntryIconPosition position)
Stock
item.
A null
value will be returned if the icon was not set from
a Stock
item.
public ImageType getIconStorageType(EntryIconPosition position)
public String getIconTooltipMarkup(EntryIconPosition position)
public String getIconTooltipText(EntryIconPosition position)
public int getMaxLength()
public boolean getOverwriteMode()
setOverwriteMode()
.public int getPosition()
Editable
getPosition
in interface Editable
public double getProgressFraction()
Entry
.public double getProgressPulseStep()
Entry
.public int getSelectionBoundsEnd()
Editable
getSelectionBoundsStart()
and
getSelectionBoundsEnd()
will be identical.getSelectionBoundsEnd
in interface Editable
public int getSelectionBoundsStart()
Editable
getSelectionBoundsStart()
and
getSelectionBoundsEnd()
will be identical.getSelectionBoundsStart
in interface Editable
public String getText()
Entry.Activate
signal.public char getTextLength()
public boolean getVisibility()
true
if characters entered are visible,
false
if obscured.public void progressPulse()
Entry
's progress indicator to enter
"activity mode", used to indicate that the application is
making progress but in a way that can't be strictly quantized.public void selectRegion(int start, int end)
Editable
start
up to but not including end
will
be selected.
Calling selectRegion(0, 0)
will remove the selection
(although that will only happen if some other Widget has the focus; in
Windows where there is only one control the user can manipulate an
Entry will end up selected no matter what).
selectRegion
in interface Editable
end
- If negative, then the selection will be from
start
to the end of the text in the Editable.public void setAlignment(float xalign)
public void setCompletion(EntryCompletion completion)
Completion is a mechanism whereby pre-populated suggestions can be offered to the user, allowing for faster data entry in some circumstances.
All configuration of the completion mechanism is done using
EntryCompletion
's methods, so see there for details.
public void setEditable(boolean editable)
public void setHasFrame(boolean setting)
true
.
As this decoration is a strong visual cue for users to realize that
they are able to enter text into a given control, your are discouraged
from turning it off unless you really need to minutely control
placement; in that case, see also
setInnerBorder()
.
public void setIconActivatable(EntryIconPosition position, boolean setting)
position
is activatable
or not.public void setIconFromIcon(EntryIconPosition position, Icon icon)
position
using an Icon from the current icon theme. If name
is
null
, no icon will be shown. If for whatever reason the
icon lookup fails, a "broken image" icon will be used
instead.public void setIconFromPixbuf(EntryIconPosition position, Pixbuf pixbuf)
public void setIconFromStock(EntryIconPosition position, Stock stock)
public void setIconSensitive(EntryIconPosition position, boolean setting)
position
should be
sensitive or insensitive.public void setIconTooltipMarkup(EntryIconPosition position, String markup)
public void setIconTooltipText(EntryIconPosition position, String text)
text
string
should be in plain text (without any Pango markup).public void setInnerBorder(int left, int right, int top, int bottom)
Ordinarily you shouldn't need this; in general you should leave things alone so that Entries appear uniform across the user's desktop. This is provided for the rare cases that minute positioning control is required (think of what goes on when you edit text in a CellRendererText) it is possible to do so.
public void setInvisibleChar(char replacement)
visibility
is false
.replacement
- The new character to be used to obscure text. A value of
0
will cause no feedback to displayed at all
when the user is typing in the Entry.public void setMaxLength(int max)
max
- A value of 0
indicates no maximum length.public void setOverwriteMode(boolean setting)
public void setPosition(int position)
Editable
setPosition
in interface Editable
position
- The value given must be less than or equal to the number of
characters currently in the Editable field. Supplying a
value of -1
will cause the cursor to move to a
position after the last character in the text.public void setProgressFraction(double fraction)
Entry
as
"filled-in".public void setProgressPulseStep(double fraction)
Entry
.public void setText(String text)
public void setVisibility(boolean setting)
true
for showing
and false
for hiding input characters.
When set to be not visible, characters entered are shown with a
'*'
instead. This default can be changed with
setInvisibleChar()
.
public void setWidthChars(int width)
As with all font related operations, there are a number of competing approximations involved. In particular, this method operates by influencing the size requested by this Widget; the box packing model will still have the final say in the size-allocation phase.
See also Label's setWidthChars()
; the
challenges and constraints involved are similar.
width
- A setting of -1
will return the Entry to normal
sizing behaviour.