Ludovic Aubert
2014-04-07 21:47:01 UTC
Subject: zooming and scrolling
To: wx-***@googlegroups.com
Using wxScrolledWindow, I would like to programmatically scroll to a given
position, in a zoomed view.
If the scale = 1, no problem, the call to wxScrolledWindow::Scroll(x,y),
where x and y are two logical coordinates (independant of the zoom scale)
works just fine, and the view is scrolled to where I want it to be.
But if the scale != 1, the call takes it to a wrong location. I can't
figure out why.
A prior call to GetScrollPixelsPerUnit() returns 1 for both axis.
Some code to illustrate how the zoom is implemented:
void MyScrolledWindow::OnDraw(wxDC& dc)
{
int x_start, y_start ;
this->GetViewStart(&x_start, &y_start) ;
dc.SetUserScale(scale, scale) ;
dc.SetDeviceOrigin(x_start, y_start) ;
draw_widgets(widgets, dc);//call to dc functions, in logical
coordinates...
}
Any help is appretiated
Thanks in advance
Ludovic
To: wx-***@googlegroups.com
Using wxScrolledWindow, I would like to programmatically scroll to a given
position, in a zoomed view.
If the scale = 1, no problem, the call to wxScrolledWindow::Scroll(x,y),
where x and y are two logical coordinates (independant of the zoom scale)
works just fine, and the view is scrolled to where I want it to be.
But if the scale != 1, the call takes it to a wrong location. I can't
figure out why.
A prior call to GetScrollPixelsPerUnit() returns 1 for both axis.
Some code to illustrate how the zoom is implemented:
void MyScrolledWindow::OnDraw(wxDC& dc)
{
int x_start, y_start ;
this->GetViewStart(&x_start, &y_start) ;
dc.SetUserScale(scale, scale) ;
dc.SetDeviceOrigin(x_start, y_start) ;
draw_widgets(widgets, dc);//call to dc functions, in logical
coordinates...
}
Any help is appretiated
Thanks in advance
Ludovic
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users