Gtk2::EntryBuffer(3)
β¨ 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 toundef
unsigned = $buffer->get_bytesβ hands you the byte count, no capinteger = $buffer->delete_text ($position=0, $n_chars=-1)β yeets some text out of there, returns an integer$position(integer) β defaults to0$n_chars(integer) β defaults to-1
$buffer->emit_deleted_text ($position, $n_chars)β manually fire off thatdeleted-textsignal energy$position(integer)$n_chars(integer)
$buffer->emit_inserted_text ($position, $chars, $n_chars)β manually trigger theinserted-textsignal, 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 integerinteger = $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 π
Gtk2Glib::Object
π COPYRIGHT π
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
- fedora 43: perl-Gtk2 1.24993-23.fc43 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms