Dear ROOT friends
I am wondering what is the best way to update text in a TGTextEntry.
Let’s say I have a TGTextEntry * fTE, which contains a TGTextBuffer * fTB. According to $ROOTSYS/tutorials/gui/guitest.C, the way to update the text would be something like
sprintf(buf, "%f", var);
fTB->Clear();
fTB->AddText(0, buf);
fTE->SetCursorPosition(fTE->GetCursorPosition());
fTE->Deselect();
gClient->NeedRedraw(fTE);
Now, in my own code I realize that I’ve been happily using the much simpler
sprintf(buf, "%f", var);
fTE->SetText(buf);
…which for my purpose works just as well! Can somebody enlighten me what the difference between the two approaches is, and if the use of the simple SetText is discouraged for some reason? Is it less portable than the complicated sequence given in guitest.C?
Many thanks in advance,
Thomas