Hi Stelios,
You can do all this in a much simpler way, eg
root > TGraph *gr =(TGraph*)gPad->WaitPrimitive();
-go the pad,
-activate the graphics editor
-select input for a polyline
-click on all the points you want to enter
-double click in the pad once you have entered the last point
At this point WaitPrimitive will return a TGraph*
You can do now
gr->SetMarkerStyle(21);
gr->SetMarkerColor(kBlue), etc
gr->Draw("ap"); or any other drawing option, eg gr->SetDrawOption("p");
Rene Brun
> Stilianos Kesisoglou wrote:
>
> Hi,
>
> I want to make a small macro that gets the x,y coordinates
> for a set of points on my pad when I click on them sequentially.
>
> I've tried something like:
>
> Float_t ptsX[3], ptsY[3];
> TMarker *mark[3];
> for (Int_t iM=0;iM<3;iM++)
> {
> mark[iM] = (TMarker*)gPad->WaitPrimitive("TMarker","Marker");
> ptsX[iM] = mark[iM]->GetX();
> ptsY[iM] = mark[iM]->GetY();
> }
>
> but doesn't work. It gets the first point correctly but then proceeds
> and
> sets all the other points like the first one (a printout shows that).
>
> Any suggestions?
>
> Thanks!
>
> Stelios.
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET