TLegendEntry return values nonsensical

Hi

I make 3 histograms and give them each different polymarkers.
I make a legend and draw it. I want outlined coloured markers which I can do myself if I can understand the following behaviour on v4-00-04 …

When I run the code below and try to retrieve the entires for the legend and see what marker style was stored they all return 21 even though it plots correctly.

I find this confusing - is there a way to get it to return the actual marker style that was stored. I want to be able to loop over the entries in a legend and get all the marker styles and sizes.

{
  TH1F* h1 = new TH1F("h1","",100,-5,5); h1->Sumw2();
  TH1F* h2 = new TH1F("h2","",100,-5,5); h2->Sumw2();
  TH1F* h3 = new TH1F("h3","",100,-5,5); h3->Sumw2();

  h1->FillRandom("gaus",100);
  h2->FillRandom("gaus",1000);
  h3->FillRandom("gaus",10000);

  h1->SetMarkerStyle(kFullSquare);
  h2->SetMarkerStyle(kFullCircle);
  h3->SetMarkerStyle(kFullTriangleUp);

  TLegend leg(0.1,0.7,.5,0.9);
  leg.AddEntry(h1,"h1","P");
  leg.AddEntry(h2,"h2","P");
  leg.AddEntry(h3,"h3","P");

  h1->Draw();
  h2->Draw("same");
  h3->Draw("same");

  leg.Draw();

  TIter next(leg.GetListOfPrimitives());
  TLegendEntry *entry;
  while (( entry = (TLegendEntry *)next() ))
  {
    cout <<" Marker style is " <<entry->GetMarkerStyle()<<endl;
  }
}

Thanks

Mark

In your code add the line
gPad->Update();
after your line
leg->Draw();

The TLegendEntry fields are only filled when the legend is painted
in the canvas.

Rene