Size of TGLabel (and TGButton)

From: Mathieu de Naurois (denauroi@polhp1.in2p3.fr)
Date: Thu Oct 01 1998 - 15:27:22 MEST


Hello Rooters,

In the Layout mechanisms (of Dialog windows), the function GetDefaultSize
is called for each Widget in the frame. 

This function is usually defined as (in TGFrame)

 TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
 
But, TGlabel redefines this function as:

 virtual TGDimension GetDefaultSize() const 
{ return TGDimension(fTWidth, fTHeight+1); } 

And the function Resize does NOT change fTWidth and fTHeight, but just
fWidth and fHeight.

The consequence is:

Even if you resize the widget with a call to the Resize function, the
Layout algorithm will resize it to its default size, that is, to the size
of the text inside. I wanted many TGLabel's to have the same size, so I
can align then on the right (with right justification of the text). The
only solution I found was to created a new classe, derived from TGLabel,
and restoring the GetDimension function to its original value.

Here is my question:

Is there any reason to redefine the GetDefaultSize function in TGLabel
(and also in TGButton and derived classes)? And if yes, how can I change
the size of a Label? (One can imagine to refine the Resize function.) 

Thank you.

-----------------------------------------------------
Mathieu de Naurois
LPNHE Ecole Polytechnique
denauroi@polhp1.in2p3.fr



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET