Re: Gtk::Editable::on_insert_text
- From: Antonio Coralles <noche suapie reflex at>
- To: gtkmm-list gnome org
- Subject: Re: Gtk::Editable::on_insert_text
- Date: Tue, 22 Feb 2005 01:26:57 +0100
Antonio Coralles wrote:
I just was thinking about the most elegant way of restricting the chars
a user can enter into a Gtk::Entry. At first i thought I should do that
by overriding on_changed() but then, after looking at the dokumentation
for Gtk::Editable the functions
virtual void insert_text_vfunc (const Glib::ustring& text, int& position)
virtual void on_insert_text (const Glib::ustring& text, int* position)
caught my attention. The problem is that these functions are completeley
undocumented - especially I don't understand what i should do with int&
/ int* position - what happens when i change the value of
position/*position ? Are these functions at least suitable for my
purpose ? Should i call [when overriding] the base class routines if i
want a char to be accepted and avoid that if i don't want that ?
Ok, after experimenting a bit I achieved what I wanted to do by
overriding insert_text_vfunc. text is the text which would be inserted
and position the position where inserting starts - which can be modified
through &. If I want the insertion to take place I call the base class
insert_text_vfunc. Eventually I can pass a modified string to that
method ...
So the question that remains is what on_insert_text is for and why does
it use int* instead of int& ?
Antonio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]