Re: DrawingArea in ScrolledWindow



Hi,

2)  How can I get the dimensions of the visible part?  (I tried
manually adding the Viewport, then calling
get_window()->get_geometry(), but that gave a value slightly too
large; that seems to track things unnecessarily and I'm not sure
exactly how much I need to deduct.)
you could do the following (not sure if it is the best solution ;-) )...

get the H- and VAdjustment of your Scrolledwindow:

   m_pHAdj=get_hadjustment();
   m_pVAdj=get_vadjustment();

connect the changed and value_changed signal

m_pHAdj->signal_value_changed ().connect( sigc::mem_fun(*this, &ScrolledWindow::on_scrollbar_changed) ); m_pVAdj->signal_value_changed ().connect( sigc::mem_fun(*this, &ScrolledWindow::on_scrollbar_changed) ); m_pHAdj->signal_changed ().connect( sigc::mem_fun(*this, &ScrolledWindow::on_scrollbar_changed) ); m_pVAdj->signal_changed ().connect( sigc::mem_fun(*this, &ScrolledWindow::on_scrollbar_changed) );

void ScrolledWindow::on_scrollbar_changed(){
   double value_v, value_h, size_v, size_h;

   value_h=m_pHAdj->get_value();
   value_v=m_pVAdj->get_value();
   size_h =m_pHAdj->get_page_size(); //current dimension
   size_v =m_pVAdj->get_page_size();  //current dimension

}

Regards Alex

--
Alexander Gehlert reply to : alexander gehlert raritan com

Raritan Deutschland GmbH, Scheringerstr. 1, 08056 Zwickau
phone +49 375-271349-30 fax +49-375-271349-99 USt-IdNr. DE813094160, HRB 23605 Chemnitz
Geschäftsführer: Dr. Christian Pätz, Swen Anderson






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