I have three DrawingArea’s inside their own respective ViewPort and ScrolledWindow as shown the image below
How can I detect horizontal or/and vertical scroll in any one of the scrolled window?
After detecting the horizontal or/and vertical scroll in any one of the scrolled window adjust the other two scrolled window horizontal or/and vertical same?
I found this Catching the scrolling event in gtk# post which suggests to use http://transit.iut2.upmf-grenoble.fr/doc/gtkmm-3.0/tutorial/html/chapter-adjustment.html
Suggested to use of attaching adjustment to scroll bar and find change in the value of the scroll bar.
Example
builder->get_widget("scrollWindow1", scrollWindow1);
scrollWindow1->set_hadjustment(Gtk::Adjustment::create(0,0,0, 0.5));
scrollWindow1->set_vadjustment(Gtk::Adjustment::create(0,0,0, 0.5));
scrollWindow1->set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC);
builder->get_widget("viewPort1", viewPort1);
Gtk::ScrolledWindow* scrollWindow1;
Gtk::DrawingArea drawingArea1;
viewPort1->add(drawingArea1);
Glib::RefPtr<Gtk::Adjustment> vAdjustment;
vAdjustment = viewModelScrollWindow1->get_vadjustment();
Gtk::Scrollbar vscrbr;
vscrbr (*vAdjustment,Gtk::ORIENTATION_VERTICAL);
vscrbr.signal_value_changed().connect(sigc::mem_fun(*this,&myClass::printVvalue));
void myClass::printVvalue()
{
std::cout<<"V value: "<<vscrbr.get_value()<<std::endl;
}
I get this error
error: no match for call to ??(Gtk::Scrollbar) (Glib::RefPtrGtk::Adjustment&, Gtk::Orientation)??
vscrbr (vAdjustment,Gtk::ORIENTATION_VERTICAL);
What am I doing wrong?
How can I do it correctly?