Re: Making a Gtk::Entry go away automatically



Marcus Lundblad wrote:

I have a Gtk::Label that when right-clicked opens a context menu.
One of the options in the menu is "rename", when this is invoked it's intended that the label "turns" into a text entry field where one can change the label and when pressing enter or clicked it changes the label. When selecting "rename" the label is replaced with the entry (this part works). So I tried connecting the on_change signal for the entry field to make it set the text of the label. However, when using this, the text entry reports as soon as a character is typed. This is not what I intend.
So, I guess I should be using some other signal.
What I would like is "signal_enter" and "signal_leave" (if those exists).
I couldn't find an example that does this.

What I want is essentually something similar to "rename" in Nautilus.

//Marcus


Hmm, I guess you want to catch a signal when the user hits enter while the focus is on your entry object. I've never tried this, but as your Entry is a Widget, I would look at

Glib::SignalProxy1<bool,GdkEventKey*>
Gtk::Widget::signal_key_press_event()

At http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html you find usefull information about the various event structures used by gtk and gtkmm.

Matthias Langer




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]