Re: No HMG4 Font object
Posted: Fri Mar 18, 2011 11:05 pm
Hi friends,
I'm sorry if I use this post, but subject corresponding to my problem.
I've download today last HMG4 and then I compile "samples\label\demo_4.prg" and doesn't work. The poblem comes from AUTOSIZE, but I think it's more complex.
In Autosize function we have this
First: QFont() create an object font, but it's not inherit from parent (this is a common problem).
Second: oFont:SetFamily( Self:FontName) can not work because the ::cFontName var is not valued - or might not be valued - and the same can happen to other variables. For this reason I get a crash.
I think we must:
I'm sorry if I use this post, but subject corresponding to my problem.
I've download today last HMG4 and then I compile "samples\label\demo_4.prg" and doesn't work. The poblem comes from AUTOSIZE, but I think it's more complex.
In Autosize function we have this
Code: Select all
oFont := QFont()
oFont:SetFamily( Self:FontName )
oFont:SetPointSize( Self:FontSize )
oFont:SetBold( Self:FontBold )
oFont:SetItalic( Self:FontItalic )
Second: oFont:SetFamily( Self:FontName) can not work because the ::cFontName var is not valued - or might not be valued - and the same can happen to other variables. For this reason I get a crash.
I think we must:
- - insert "::Font( ::oParent:oQtObject:Font() )" at the beginning of every control in this way we inherit Font object from window and setup a default font object for this object (more or less the same can be for form
- - change Font method in control.prg
Code: Select all
ELSEIF Valtype( xValue ) == "O"
::oFont := xValue
::oQTObject:SetFont( ::oFont )
::cFontName := ::oFont:family()
::nFontSize := IF( ::oFont:pointSize()==-1, ::oFont:pixelSize(), ::oFont:pointSize() )
::lFontBold := ::oFont:bold()
::lFontItalic := ::oFont:italic()
::lFontUnderLine := ::oFont:strikeOut()
::lFontStrikeOut := ::oFont:underline()