Package: gtk

Interface gtk:editable

Superclasses

gobject:object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

Direct Slots

cursor-position
The cursor-position property of type :int (Read)
The current position of the insertion cursor in chars.
Allowed values: [0, 65535]
Default value: 0
editable
The editable property of type :boolean (Read / Write)
Whether the contents of the editable widget can be edited.
Default value: true
enable-undo
The enable-undo property of type :boolean (Read / Write)
Whether undo/redo should be enabled for the editable widget.
Default value: true
max-width-chars
The max-width-chars property of type :int (Read / Write)
The desired maximum width of the editable widget, in characters.
Allowed values: >= -1
Default value: -1
selection-bound
The selection-bound property of type :int (Read)
The position of the opposite end of the selection from the cursor in chars.
Allowed values: [0, 65535]
Default value: 0
text
The text property of type :string (Read / Write)
The contents of the editable widget.
Default value: ""
width-chars
The width-chars property of type :int (Read / Write)
The number of characters to leave space for in the editable widget.
Allowed values: >= -1
Default value: -1
xalign
The xalign property of type :float (Read / Write)
The horizontal alignment, from 0.0 (left) to 1.0 (right). Reversed for RTL layouts.
Allowed values: [0.0, 1.0]
Default value: 0.0

Details

The gtk:editable interface is an interface which should be implemented by text editing widgets, such as the gtk:entry and gtk:spin-button widgets. It contains functions for generically manipulating an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of an editable widget.

Examples

As an example of the latter usage, by connecting the following handler to the "insert-text" signal, an application can convert all entry into an editable widget into uppercase.
;; Handler for the "insert-text" signal
(setf handlerid
      (g:signal-connect entry "insert-text"
          (lambda (editable text length position)
            (g:signal-handler-block editable handlerid)
            (gtk:editable-insert-text editable
                                      (string-upcase text)
                                      (cffi:mem-ref position :intptr))
            (g:signal-stop-emission editable "insert-text")
            (g:signal-handler-unblock editable handlerid))))    

Signal Details

The "changed" signal
lambda (editable)    :run-last      
editable
The gtk:editable widget which received the signal.
The signal is emitted at the end of a single user visible operation on the contents of the editable widget. For example, a paste operation that replaces the contents of the selection will cause only one signal emission, even though it is implemented by first deleting the selection, then inserting the new content, and may cause multiple "notify::text" signals to be emitted.
The "delete-text" signal
lambda (editable start end)    :run-last      
editable
The gtk:editable widget which received the signal.
start
The integer with the start position.
end
The integer with the end position.
The signal is emitted when text is deleted from the editable widget by the user. The default handler for this signal will normally be responsible for deleting the text, so by connecting to this signal and then stopping the signal with the g:signal-stop-emission function, it is possible to modify the range of deleted text, or prevent it from being deleted entirely. The start and end parameters are interpreted as for the gtk:editable-delete-text function.
The "insert-text" signal
lambda (editable text length position)    :run-last      
editable
The gtk:editable widget which received the signal.
text
The string with the new text to insert.
length
The integer with the length of the new text, in bytes, or -1 if text is null-terminated.
position
The pointer to an integer with the position, in characters, at which to insert the new text. This is an in-out parameter. After the signal emission is finished, it should point after the newly inserted text. You get the Lisp value of position with the call (cffi:mem-ref position :intptr).
The signal is emitted when text is inserted into the editable widget by the user. The default handler for this signal will normally be responsible for inserting the text, so by connecting to this signal and then stopping the signal with the g:signal-stop-emission function, it is possible to modify the inserted text, or prevent it from being inserted entirely.
 

Inherited Slot Access Functions

See also

2024-5-17