I am writing a GUI that utilizes a TEmbeddedCanvas in a TGMainFrame object. When I create and draw my graph to the TEmbeddedCanvas, it is not displayed. However, when I resize the window (by dragging the sizing controls), the window is updated and I see the graph. How do I force the display of the graph in the TEmbeddedCanvas automatically. I tried DoRedraw and that didn’t seem to have any effect.
What you need is to update the canvas. Please find below an example where fEcan is the embedded canvas pointer.
Best regards, Ilka
TCanvas *c1 = fEcan->GetCanvas(); // fEcan is the embedded canvas pointer
c1->SetFillColor(42);
c1->SetGrid();
const Int_t n = 20;
Double_t x[n], y[n];
for (Int_t i=0;i<n;i++) {
x[i] = i0.1;
y[i] = 10sin(x[i]+0.2);
printf(" i %i %f %f \n",i,x[i],y[i]);
}
gr = new TGraph(n,x,y);
gr->SetLineColor(2);
gr->SetLineWidth(4);
gr->SetMarkerColor(4);
gr->SetMarkerStyle(21);
gr->SetTitle(“a simple graph”);
gr->GetXaxis()->SetTitle(“X title”);
gr->GetYaxis()->SetTitle(“Y title”);
gr->Draw(“ACP”);
// TCanvas::Update() draws the frame, after which it can be changed
c1->Update();
c1->GetFrame()->SetFillColor(21);
c1->GetFrame()->SetBorderSize(12);
c1->Modified();
c1->Update();
Thanks. This helped and worked. I am wondering whether you know whether using QT provides any enhancements to creating GUIs that is not available in ROOT itself?
[quote=“jon149”]Thanks. This helped and worked. I am wondering whether you know whether using QT provides any enhancements to creating GUIs that is not available in ROOT itself?
Thanks.[/quote]
Yes, my believe Qt does provide a lot of enhancements and what is essential it rather stable and robust environment
The main advantage of working with Qt is the time saving:
Qt-based GUI code is generally much shorter hence less time to write, less chances to make a mistake
Qt provides a lot of ready-to-use Widget. Some of them are included in the distribution others can be downloaded form the various Web sites.
If you are going to work on Linux then you can enjoy the KDE environment that comes with hundreds of well designed and thoroughly debugged widgets. kde.org/ kde-redhat.sourceforge.net/ kde.org/whatiskde/qt.php
see examples kde-apps.org/
You can use Qt Designer (or KDesinger kdevelop.org/graphics/screen … signer.png in case of the KDE env) as result the most complex part of the code will be written for automatically and you can devote your time to polish your concrete algorithm you are create the GUI for.
As result as soon as you have a clear idea how your GUI should look and behave like you can create an working inter4face in a day.
To prove that I am willing to create one for you. If you havegot a clear idea about your GUI and can describe this idea the can have created a Qt project and generate the working version of GUI. So you will have something you can start to work with.
You can find the further information on root.bnl.gov Web site
Thanks for your very informative response. I am trying to understand the best solution. What is the difference between KDE and Qt? Are they based on the same engine. I am hoping to develop a solution that will run under Linux as well as MacOS 10.x. I understand that Qt is available for boh platforms. However, is KDE only Linux specific? Is there any way that I can take advantage of the Aqua interface under MacOs?
By the way, i have really started to get into the intrinsics of Root and am very impressed with the framework you have developed. It is absolutely fantastic.