2014-11-01 61 views

回答

1

Gtk::EventBox不繼承Gtk::Scrollable
和爲此得到了Gtk::Viewport
包裹,當它被添加到一個Gtk::ScrolledWindow

要禁用滾動到集中的孩子,你需要改變focus_hadjustment/focus_vadjustment

//Disable scroll to focused child 
auto viewport = dynamic_cast<Gtk::Viewport*>(m_scrolled.get_child()); 
if (viewport) { 
    auto dummy_adj = Gtk::Adjustment::create(0,0,0); 
    viewport->set_focus_hadjustment(dummy_adj); 
    viewport->set_focus_vadjustment(dummy_adj); 
}