Hello,
I am attempting to use TDialogCanvas + TButton using example in
TButton.html documentation
on Win2K with release 3.05/3 or 3.05/5. First, the example does not quite
work as is. I have
included my mods to it at the end of this not - changed lines indicted with
***
*** : nested quotes problem..
***note1*** : require to get graph to display inside un-named button
***note2*** : required to make un-named button clickable.
Any comments on note1 and note2? Is this the right thing to do? Its not
clear from the docs.
Another problem is, that /tutorials/graph.c hangs up when it attemps to
create a new TCanvas.
However but2 is able to create canvas. Note: I have no trouble creating
TCanvas from a button
on a TControlBar.
Thanks,
Ed Oltman
void but() {
// example of a dialogcanvas with a few buttons
TDialogCanvas *dialog = new TDialogCanvas("dialog","",200,300);
// Create first button. Clicking on this button will execute 34+56
TButton *but1 = new TButton("button1","34+56",.05,.8,.45,.88);
but1->Draw();
// Create second button. Clicking on this button will create a new canvas
TButton *but2 = new TButton("canvas","c2 = new
TCanvas(\"c2\")",.55,.8,.95,.88); ***
but2->Draw();
// Create third button. Clicking on this button will invoke the browser
but3 = new TButton("Browser","br = new
TBrowser(\"br\")",0.25,0.54,0.75,0.64); ***
but3->SetFillColor(42);
but3->Draw();
// Create last button with no name. Instead a graph is draw inside the
button
// Clicking on this button will invoke the macro tutorials/graph.C
button = new TButton("",".x tutorials/graph.C",0.15,0.15,0.85,0.38);
button->SetFillColor(42);
button->Draw();
button->SetEditable(kTRUE); ***note1****
button->cd();
Double_t x[8] = {0.08,0.21,0.34,0.48,0.61,0.7,0.81,0.92};
Double_t y[8] = {0.2,0.65,0.4,0.34,0.24,0.43,0.75,0.52};
TGraph *graph = new TGraph(8,x,y);
graph->SetMarkerColor(4);
graph->SetMarkerStyle(21);
graph->Draw("lp");
dialog->cd();
dialog->SetEditable(kFALSE); ***note2***
}
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET