Gtk2::EntryBuffer(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

✨ NAME ✨

Gtk2::EntryBuffer β€” bestie, it's literally just a wrapper for GtkEntryBuffer πŸ’…


πŸ¦‹ HIERARCHY πŸ¦‹

Glib::Object
+----Gtk2::EntryBuffer

So the tea is this: the Gtk2::EntryBuffer class holds the actual text that shows up inside a Gtk2::Entry widget. That's it. That's the whole job. πŸ‘‘

And here's the iconic part β€” one single Gtk2::EntryBuffer object can be shared by multiple Gtk2::Entry widgets, and they'll all share the same text content. But not the cursor position, visibility attributes, icon, etc. Just the text. Sharing is caring but boundaries are healthy, iykyk 🫢

You can also derive from Gtk2::EntryBuffer β€” like, subclass it, make it your main character. A derived class might store text somewhere else entirely, like non-pageable memory, which is highkey useful if you're dealing with important passwords πŸ”. Or a derived class could hook into your app's whole undo/redo situation. Very demure, very mindful ✨


πŸ’– METHODS πŸ’–

  • entrybuffer = Gtk2::EntryBuffer->new ($initial_chars=undef) β€” makes you a fresh buffer, bestie
    • $initial_chars (string) β€” the starting text, optional, defaults to undef
  • unsigned = $buffer->get_bytes β€” hands you the byte count, no cap
  • integer = $buffer->delete_text ($position=0, $n_chars=-1) β€” yeets some text out of there, returns an integer
    • $position (integer) β€” defaults to 0
    • $n_chars (integer) β€” defaults to -1
  • $buffer->emit_deleted_text ($position, $n_chars) β€” manually fire off that deleted-text signal energy
    • $position (integer)
    • $n_chars (integer)
  • $buffer->emit_inserted_text ($position, $chars, $n_chars) β€” manually trigger the inserted-text signal, go off
    • $position (integer)
    • $chars (string)
    • $n_chars (integer)
  • $buffer->insert_text ($position, $chars) β€” drop new text into the buffer at a spot you pick
    • $position (integer)
    • $chars (string)
  • integer = $buffer->get_length β€” how long is the text rn, as an integer
  • integer = $buffer->get_max_length β€” what's the max length cap, as an integer
  • $buffer->set_max_length ($max_length) β€” set that cap, periodt
    • $max_length (integer)
  • string = $buffer->get_text β€” gimme the text, as a string
  • $buffer->set_text ($chars) β€” replace the whole text with something new
    • $chars (string)

πŸŽ€ PROPERTIES πŸŽ€

  • 'length' (Glib::UInt : default 0 : readable / private / static-nick / static-blurb) β€” Length of the text currently in the buffer
  • 'max-length' (integer : default 0 : readable / writable / private / static-nick / static-blurb) β€” Maximum number of characters for this entry. Zero if no maximum
  • 'text' (string : default "" : readable / writable / private / static-nick / static-blurb) β€” The contents of the buffer

🌸 SIGNALS 🌸

  • deleted-text (Gtk2::EntryBuffer, Glib::UInt, Glib::UInt)
  • inserted-text (Gtk2::EntryBuffer, Glib::UInt, string, Glib::UInt)

That's the whole signal roster, bestie. Listen for 'em, emit 'em, whatever feels right. πŸ’œ


🌈 SEE ALSO 🌈

  • Gtk2
  • Glib::Object

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


okay that's the whole page, you ate it, no crumbs left πŸ“βœ¨ perl v5.42.0, dated 2025-07-25 β€” mwah, love u, go build something cute πŸ’–πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from