Re: Gtk::Container::set_focus_chain() problem
- From: Phil Wolff <adiabat centurylink net>
- To: Kjell Ahlstedt <kjell ahlstedt bredband net>
- Cc: "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: Re: Gtk::Container::set_focus_chain() problem
- Date: Wed, 11 Mar 2015 15:10:53 -0700
Good call. Your rifle is much more effective than my shotgun.
On 2015/03/10 11:06, Kjell Ahlstedt wrote:
Here's a better solution. Now I've tested it.
std::vector<Gtk::Widget*> focus_chain;
focus_chain.push_back(&m_ButtonBox);
m_VBox.set_focus_chain(focus_chain);
m_TextView is the child of m_ScrolledWindow, which is a child of
m_VBox. You must set m_VBox's focus chain so it contains all m_VBox's
children except m_ScrolledWindow. In this case it means m_ButtonBox,
since m_ScrolledWindow and m_ButtonBox are the only children of m_VBox.
Kjell
Den 2015-03-10 18:35, Kjell Ahlstedt skrev:
Sorry, I jumped to conclusions. set_can_focus(false) makes it
impossible to edit the text view. That's perhaps not what you want.
Kjell
Den 2015-03-10 18:27, Kjell Ahlstedt skrev:
m_TextView.set_can_focus(false);
Den 2015-03-10 15:19, Phil Wolff skrev:
Gtk (and therefore gtkmm as well) will by default add a TextView widget
to the focus chain. If you're tabbing through the chain and you
encounter a TextView, the focus gets trapped there because tabs are now
entered into the TextView's buffer rather than moving the focus to the
next widget in the chain. The sample code at
https://developer.gnome.org/gtkmm-tutorial/stable/sec-textview-examples.html.en
illustrates the problem -- click the "Use buffer 1" button and hit the
tab key a few times.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]