Re: Gtk::Container::set_focus_chain() problem



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.

I added

        std::vector<Gtk::Widget*> v;
        v.push_back(&m_Button_Buffer1);
        v.push_back(&m_Button_Buffer2);
        v.push_back(&m_Button_Quit);
        m_ScrolledWindow.set_focus_chain(v);

but the TextView widget still was handed the focus.

I tried passing an empty vector as the argument, thinking that the focus
chain would be completely disabled. This had no apparent effect --
tabbing still cycled through all of the widgets and once again was
trapped in the TextView.

I also tried

        m_Button_Quit.get_toplevel()->set_focus_chain(v);

again to no effect.

Any ideas?

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




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