Missing function - SetTextColorAlpha

Hello!

I’m using ROOT 5.34/14. Recently, while working on my new project, it appeared that I can’t use function TAttText::SetColorAlpha(tcolor, talpha). It gives me following error:

[quote]Error: Can’t call TLatex::SetTextColorAlpha(kBlack,1) in current scope PeakSearch.c:1013:
Possible candidates are…
(in TLatex)
(in TText)
*** Interpreter error recovered ***
[/quote]

My part of code that generates this error:

TLatex *latextransparent2 = new TLatex(); latextransparent2->DrawLatex(500,500,"Al"); latextransparent2->SetTextColorAlpha(kBlack,1);

I’ve checked include file TAttText.h - and apparently there’s no definition of such function, even though documentation says something else.

Is there any way to add this function somehow?

Or maybe there’s a different way to make a TLatex object transparent?

Thanks in advance

Cheers,
Przemek

I think this is because your ROOT version is pretty old. Use the latest one, ROOT 6.08/00 or 5.34.36 (not sure if SetAlpha is present in the ROOT v5 branch)

Well, the thing is im using pretty old laptop with 32bit system architecture. Your solution came through my mind, but there is no ROOT v6 version compatible with 32bit systems from what I saw - unless it’s possible to install x86_64 versions on 32bit OS. Keeping that in mind, I’d rather stay with what I have right now.

Getting back to my initial problem with transparency - I want to make some TLatex objects hidden while clicking a button. If I can’t make it with transparency, is it possible to get the same result any other way?

Cheers.

  • you can set the text size to 0
  • you can set the text color = to the background color
  • you can delete the text

[quote=“couet”][quote]
I want to make some TLatex objects hidden while clicking a button. If I can’t make it with transparency, is it possible to get the same result any other way?

[/quote]

- you can set the text size to 0

  • you can set the text color = to the background color
  • you can delete the text[/quote]

This one is brilliant, shame I didn’t think about it myself, thanks!