Hello,
What you do in your example is a bit different from what is done when you click on TView in the pad and use ZoomIn. Attached you will find an example using ZoomIn() in your method ShowView and you will see that it works. I understand that is not exactly what you want to I am now investigating in order to understand what is going wrong with your original example.
Cheers, Olivier Couet
> ---------- Forwarded message ----------
> Date: Thu, 16 Feb 2006 11:33:01 +0100 (CET)
> From: G.Mavromanolakis <gmavroma_at_mail.cern.ch>
> To: roottalk_at_pcroot.cern.ch
> Cc: gmavroma_at_mail.cern.ch
> Subject: [ROOT] problem with TView zoom
>
> Hello ROOTers,
>
> I am developing a 3d event display for a monitor application.
> I used ROOTv4.02.00 under ScientificLinux3 and I tried to switched
> recently to a newer version. I experience some strange behavior from
> the zoom methods in TView class. They work as expected
> when invoked within the CINT or by clicking a TView object on a
> pad. But when they are put in a macro or source code they produce
> no effect.
> For example something like
>
> void test()
> {
> TCanvas *c1 = new TCanvas("c1","The ... canvas",200,10,700,700);
> c1->cd();
>
> BuildLayout()->Draw();
> //ShowAxis(-15,-15,-20,4);
> ShowView(1.);
>
>
> TCanvas* c2 = new TCanvas("c2","The ... canvas",200,10,700,700);
> c2->cd();
>
> BuildLayout()->Draw();
> //ShowAxis(-15,-15,-20,4);
> ShowView(0.5);
>
> }
>
> with
>
> void ShowView(float zoomfactor)
> {
> gPad->GetView()->ZoomView(0,zoomfactor);
> gPad->SetFillColor(17);//light grey
> gPad->Modified();
> gPad->Update();
> }
>
> should produce 2 canvases with one normal and one small view.
> This is the case for v4.02.00 or older. When trying with a newer version
> (4.04.02g, 5.08.00) there is no zoom, the example above
> gives 2 identical canvases!
>
> Also the TView::Zoom, ZoomIn, ZoomOut methods behave similarly
> strange, ie they give no effect.
>
> Any hints??? Am I doing something wrong???
>
> Thanks and regards,
> George
>
> PS. I attach a small example macro
> (run it from root with
> .L test.C
> test()
> )
-- Org: CERN - European Laboratory for Particle Physics. Mail: 1211 Geneve 23 - Switzerland Mailbox: J25910 E-Mail: Olivier.Couet_at_cern.ch Phone: +41 22 7676522 WWW: http://cern.ch/Olivier.Couet/ Fax: +41 22 7670300Received on Fri Feb 17 2006 - 16:00:53 MET
- TEXT/PLAIN attachment: test2.C
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET