1.56 <GtkEntryBuffer>

Class: <GtkEntryBuffer>

It derives from <GObject>.

Holds the text that is displayed in a single-line text entry widget.

A single <GtkEntryBuffer> object can be shared by multiple widgets which will then share the same text content, but not the cursor position, visibility attributes, icon etc.

<GtkEntryBuffer> may be derived from. Such a derived class might allow text to be stored in an alternate location, such as non-pageable memory, useful in the case of important passwords. Or a derived class could integrate with an application’s concept of undo/redo.

Fields

parent-instance

Properties

Property: entry-buffer:length self

The length (in characters) of the text in buffer.

Its value is an unsigned 32-bit integer.

It is read only.

Property: entry-buffer:max-length self

The maximum length (in characters) of the text in the buffer.

Its value is a 32-bit integer.

Set it with (set! (entry-buffer:max-length self) value).

Property: entry-buffer:text self

The contents of the buffer.

Its value is a string, or #f.

Set it with (set! (entry-buffer:text self) value).

Procedures

Method: entry-buffer:delete-text self position n-chars ⇒ %return
Method: delete-text self position n-chars ⇒ %return

Deletes a sequence of characters from the buffer.

n-chars characters are deleted starting at position. If n-chars is negative, then all characters until the end of the text are deleted.

If position or n-chars are out of bounds, then they are coerced to sane values.

Note that the positions are specified in characters, not bytes.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

position

Passed: an unsigned 32-bit integer.

position at which to delete text

n-chars

Passed: a 32-bit integer.

number of characters to delete

%return

Returned: an unsigned 32-bit integer.

The number of characters deleted.

Method: entry-buffer:emit-deleted-text self position n-chars
Method: emit-deleted-text self position n-chars

Used when subclassing <GtkEntryBuffer>.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

position

Passed: an unsigned 32-bit integer.

position at which text was deleted

n-chars

Passed: an unsigned 32-bit integer.

number of characters deleted

Method: entry-buffer:emit-inserted-text self position chars n-chars
Method: emit-inserted-text self position chars n-chars

Used when subclassing <GtkEntryBuffer>.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

position

Passed: an unsigned 32-bit integer.

position at which text was inserted

chars

Passed: a string.

text that was inserted

n-chars

Passed: an unsigned 32-bit integer.

number of characters inserted

Method: entry-buffer:get-bytes self ⇒ %return
Method: get-bytes self ⇒ %return

Retrieves the length in bytes of the buffer.

See entry-buffer:get-length.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

%return

Returned: an unsigned 64-bit integer.

The byte length of the buffer.

Method: entry-buffer:get-length self ⇒ %return
Method: get-length self ⇒ %return

Retrieves the length in characters of the buffer.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

%return

Returned: an unsigned 32-bit integer.

The number of characters in the buffer.

Method: entry-buffer:get-max-length self ⇒ %return
Method: get-max-length self ⇒ %return

Retrieves the maximum allowed length of the text in self.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

%return

Returned: a 32-bit integer.

the maximum allowed number of characters in <GtkEntryBuffer>, or 0 if there is no maximum.

Method: entry-buffer:get-text self ⇒ %return
Method: get-text self ⇒ %return

Retrieves the contents of the buffer.

The memory pointer returned by this call will not change unless this object emits a signal, or is finalized.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

%return

Returned: a string.

a pointer to the contents of the widget as a string. This string points to internally allocated storage in the buffer and must not be freed, modified or stored.

Method: entry-buffer:insert-text self position chars n-chars ⇒ %return
Method: insert-text self position chars n-chars ⇒ %return

Inserts n-chars characters of chars into the contents of the buffer, at position position.

If n-chars is negative, then characters from chars will be inserted until a null-terminator is found. If position or n-chars are out of bounds, or the maximum buffer text length is exceeded, then they are coerced to sane values.

Note that the position and length are in characters, not in bytes.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

position

Passed: an unsigned 32-bit integer.

the position at which to insert text.

chars

Passed: a string.

the text to insert into the buffer.

n-chars

Passed: a 32-bit integer.

the length of the text in characters, or -1

%return

Returned: an unsigned 32-bit integer.

The number of characters actually inserted.

Procedure: entry-buffer:new initial-chars n-initial-chars ⇒ %return

Create a new <GtkEntryBuffer> object.

Optionally, specify initial text to set in the buffer.

initial-chars

Passed: a string, or #f.

initial buffer text

n-initial-chars

Passed: a 32-bit integer.

number of characters in initial-chars, or -1

%return

Returned: a <GtkEntryBuffer>.

A new <GtkEntryBuffer> object.

Method: entry-buffer:set-max-length self max-length
Method: set-max-length self max-length

Sets the maximum allowed length of the contents of the buffer.

If the current contents are longer than the given length, then they will be truncated to fit.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

max-length

Passed: a 32-bit integer.

the maximum length of the entry buffer, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.

Method: entry-buffer:set-text self chars n-chars
Method: set-text self chars n-chars

Sets the text in the buffer.

This is roughly equivalent to calling entry-buffer:delete-text and entry-buffer:insert-text.

Note that n-chars is in characters, not in bytes.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

chars

Passed: a string.

the new text

n-chars

Passed: a 32-bit integer.

the number of characters in text, or -1

Signals

Signal: entry-buffer:deleted-text

Connect a handler with (connect object entry-buffer:deleted-text handler). It is called as (handler self position n-chars).

The text is altered in the default handler for this signal.

If you want access to the text after the text has been modified, use after.

self

Passed: a <GtkEntryBuffer>.

position

Passed: an unsigned 32-bit integer.

the position the text was deleted at.

n-chars

Passed: an unsigned 32-bit integer.

The number of characters that were deleted.

Signal: entry-buffer:inserted-text

Connect a handler with (connect object entry-buffer:inserted-text handler). It is called as (handler self position chars n-chars).

This signal is emitted after text is inserted into the buffer.

self

Passed: a <GtkEntryBuffer>.

position

Passed: an unsigned 32-bit integer.

the position the text was inserted at.

chars

Passed: a string.

The text that was inserted.

n-chars

Passed: an unsigned 32-bit integer.

The number of characters that were inserted.

Virtual methods

Virtual method: entry-buffer:do-delete-text implementor self position n-chars ⇒ %return

Deletes a sequence of characters from the buffer.

n-chars characters are deleted starting at position. If n-chars is negative, then all characters until the end of the text are deleted.

If position or n-chars are out of bounds, then they are coerced to sane values.

Note that the positions are specified in characters, not bytes.

To override it in a new class, give register-type #:vfuncs `((delete-text . ,procedure)). The procedure is called as (procedure self position n-chars) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkEntryBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

position

Passed: an unsigned 32-bit integer.

position at which to delete text

n-chars

Passed: an unsigned 32-bit integer.

number of characters to delete

%return

Returned: an unsigned 32-bit integer.

The number of characters deleted.

Virtual method: entry-buffer:do-deleted-text implementor self position n-chars

To override it in a new class, give register-type #:vfuncs `((deleted-text . ,procedure)). The procedure is called as (procedure self position n-chars).

implementor

Passed: the class whose implementation to call: <GtkEntryBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkEntryBuffer>.

position

Passed: an unsigned 32-bit integer.

n-chars

Passed: an unsigned 32-bit integer.

Virtual method: entry-buffer:do-get-length implementor self ⇒ %return

Retrieves the length in characters of the buffer.

To override it in a new class, give register-type #:vfuncs `((get-length . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkEntryBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

%return

Returned: an unsigned 32-bit integer.

The number of characters in the buffer.

Virtual method: entry-buffer:do-get-text implementor self n-bytes ⇒ %return

To override it in a new class, give register-type #:vfuncs `((get-text . ,procedure)). The procedure is called as (procedure self n-bytes) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkEntryBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkEntryBuffer>.

n-bytes

Passed: an unsigned 64-bit integer.

%return

Returned: a string.

Virtual method: entry-buffer:do-insert-text implementor self position chars n-chars ⇒ %return

Inserts n-chars characters of chars into the contents of the buffer, at position position.

If n-chars is negative, then characters from chars will be inserted until a null-terminator is found. If position or n-chars are out of bounds, or the maximum buffer text length is exceeded, then they are coerced to sane values.

Note that the position and length are in characters, not in bytes.

To override it in a new class, give register-type #:vfuncs `((insert-text . ,procedure)). The procedure is called as (procedure self position chars n-chars) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkEntryBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkEntryBuffer>.

a <GtkEntryBuffer>

position

Passed: an unsigned 32-bit integer.

the position at which to insert text.

chars

Passed: a string.

the text to insert into the buffer.

n-chars

Passed: an unsigned 32-bit integer.

the length of the text in characters, or -1

%return

Returned: an unsigned 32-bit integer.

The number of characters actually inserted.

Virtual method: entry-buffer:do-inserted-text implementor self position chars n-chars

To override it in a new class, give register-type #:vfuncs `((inserted-text . ,procedure)). The procedure is called as (procedure self position chars n-chars).

implementor

Passed: the class whose implementation to call: <GtkEntryBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkEntryBuffer>.

position

Passed: an unsigned 32-bit integer.

chars

Passed: a string.

n-chars

Passed: an unsigned 32-bit integer.