Making TLables in code ... strange Font and Width behaviour
Publicado: Jue Dic 31, 2015 11:32 am
Happy New Year to everyone, but still doing a bit of work in 2015.
A simple test program with a mainform and making 3 TLabels in code. All 3 TLabels have same width and height. Xailer 4.0
All works OK as expected without any lBold
When I make TLabel3, :lBold := TRUE ...
- All 3 TLabels go bold?
- TLabel1 & TLabel2 chop of some text on the right hand side, nWidth has changed?
Here is my simple code ....
METHOD FormInitialize( oSender ) CLASS TForm1
local oLabel1, oLabel2, oLabel3
oLabel1 := TLabel():New( self )
oLabel1:SetBounds( 200, 150, 300, 30 )
oLabel1:cText := "In Code, TLabel 300 wide"
oLabel1:Create()
oLabel2 := TLabel():New( self )
oLabel2:SetBounds( 200, 200, 300, 30 )
oLabel2:cText := "In Code Red, TLabel 300 wide"
oLabel2:nClrText := CLR_RED
oLabel2:Create()
oLabel3 := TLabel():New( self )
oLabel3:SetBounds( 200, 250, 300, 30 )
oLabel3:cText := "In Code Red and this one BOLD, TLabel 300 wide"
// Without this line .... all TLabels are OK
// When I include this line .... all TLabels go BOLD!!
oLabel3:oFont:lBold := TRUE
// Adding these lines to give oLabel3 its own oFont .... does not solve the problem.
// oLabel3:lParentFont := .F.
// oLabel3:oFont := TFont():Create( "MS Sans Serif", 8, 0, 400 )
oLabel3:nClrText := CLR_RED
oLabel3:Create()
RETURN Nil
So question is what am I doing wrong or what is going on here?
Thank you for any thoughts.
Chris
A simple test program with a mainform and making 3 TLabels in code. All 3 TLabels have same width and height. Xailer 4.0
All works OK as expected without any lBold
When I make TLabel3, :lBold := TRUE ...
- All 3 TLabels go bold?
- TLabel1 & TLabel2 chop of some text on the right hand side, nWidth has changed?
Here is my simple code ....
METHOD FormInitialize( oSender ) CLASS TForm1
local oLabel1, oLabel2, oLabel3
oLabel1 := TLabel():New( self )
oLabel1:SetBounds( 200, 150, 300, 30 )
oLabel1:cText := "In Code, TLabel 300 wide"
oLabel1:Create()
oLabel2 := TLabel():New( self )
oLabel2:SetBounds( 200, 200, 300, 30 )
oLabel2:cText := "In Code Red, TLabel 300 wide"
oLabel2:nClrText := CLR_RED
oLabel2:Create()
oLabel3 := TLabel():New( self )
oLabel3:SetBounds( 200, 250, 300, 30 )
oLabel3:cText := "In Code Red and this one BOLD, TLabel 300 wide"
// Without this line .... all TLabels are OK
// When I include this line .... all TLabels go BOLD!!
oLabel3:oFont:lBold := TRUE
// Adding these lines to give oLabel3 its own oFont .... does not solve the problem.
// oLabel3:lParentFont := .F.
// oLabel3:oFont := TFont():Create( "MS Sans Serif", 8, 0, 400 )
oLabel3:nClrText := CLR_RED
oLabel3:Create()
RETURN Nil
So question is what am I doing wrong or what is going on here?
Thank you for any thoughts.
Chris