Hi,
I am trying to set the canvas size when creating the canvas. But when opened via TBrowser the Canvas has allways assigned the defualt 800*600 size.
I am running compiled program, not a macro. My testing code looks as follows:
#include <TCanvas.h>
#include <TFile.h>
#include
#include
#include
int main(){
TCanvas* c1 = new TCanvas(“c1”, “test size”, 10, 10, 50, 400);
c1->SetWindowSize(100, 100);
c1->Divide(3, 2);
TFile* out = new TFile("test.root", "RECREATE");
out->cd();
c1->Write();
out->Save();
out->Close();
if(c1) delete c1;
if(out) delete out;
return 0;
}
The code is compiled and executed of course.
But if I open the output file and run the TBrowser and then “dump” the canvas before drawing it - I will get following nubers:
…
fWindowTopX 0 Top X position of window (in pixels)
fWindowTopY 0 Top Y position of window (in pixels)
fWindowWidth 0 Width of window (including borders, etc.)
fWindowHeight 0 Height of window (including menubar, borders, etc.)
fCw 46 Width of the canvas along X (pixels)
fCh 372 Height of the canvas along Y (pixels)
…
- so the size (fCw and fCh) seems OK, but the “fWindowWidth” and “fWindowHeight” are equall to 0. When plotting the canvas the root that will use the defaul 800*600 size because of these two zeros.
If I dump the canvas after drawing I get:
…
fWindowTopX 4 Top X position of window (in pixels)
fWindowTopY 27 Top Y position of window (in pixels)
fWindowWidth 800 Width of window (including borders, etc.)
fWindowHeight 600 Height of window (including menubar, borders, etc.)
fCw 796 Width of the canvas along X (pixels)
fCh 571 Height of the canvas along Y (pixels)
…
- the canvas was assigned the default values.
**
Apart from this problen the function “SetCanvasSize” called wai right click on the canvas has also no effect.
Am I doing something wrong or … ?
thanks
Matus