You have been added to the developers list.
Regarding the button caption,
yes there is a bug.
Change the line# 732 of /hmg.4/svn/source/control.prg to as follows and re-build hmg library:
Code: Select all
::oQTObject:setText( cValue )
Moderator: Rathinagiri
Code: Select all
::oQTObject:setText( cValue )
#include "hmg.ch"
Function Main
Local oWindow , oButton1
With Object oWindow := Window():New()
:Width := 240
:Height := 80
:Type := WND_MAIN
:OnInit := { || oWindow:Center() }
With Object oButton1 := Button():New()
:Row := 20
:Col := 20
:Width := 200
:Caption := 'Click to Change Font'
:OnClick := { || ChangeFont(oButton1) }
End With
End With
oWindow:Activate()
Return
FUNCTION ChangeFont(oButton1)
Static oFont1
Static lFont1
IF lFont1 == NIL
lFont1 := .T.
oFont1 := QFont()
ENDIF
IF lFont1
oFont1:setBold( .T. )
oFont1:setItalic( .T. )
oFont1:setUnderline( .T. )
oButton1:oFont := oFont1
// oButton1:FontStrikeOut := .T.
oButton1:Caption := 'Bold, Italic, Strike and Underline'
ELSE
oFont1:setBold( .F. )
oFont1:setItalic( .F. )
oFont1:setUnderline( .F. )
oButton1:oFont := oFont1
// oButton1:FontStrikeOut := .F.
oButton1:Caption := 'Normal Font'
ENDIF
lFont1 := ! lFont1
RETURN NIL
Code: Select all
#include "hmg.ch"
Function Main
Local oWindow , oButton1
With Object oWindow := Window():New()
:Width := 240
:Height := 80
:Type := WND_MAIN
:OnInit := { || oWindow:Center() }
With Object oButton1 := Button():New()
:Row := 20
:Col := 20
:Width := 200
:Caption := 'Click to Change Font'
:OnClick := { || ChangeFont(oButton1) }
End With
End With
oWindow:Activate()
Return
FUNCTION ChangeFont(oButton1)
Static lFont1
IF lFont1 == NIL
lFont1 := .T.
ENDIF
IF lFont1
oButton1:FontBold := .t.
oButton1:FontItalic := .t.
oButton1:FontUnderline := .t.
oButton1:FontStrikeOut := .t.
oButton1:Caption := 'Bold, Italic, Strike and Underline'
ELSE
oButton1:FontBold := .f.
oButton1:FontItalic := .f.
oButton1:FontUnderline := .f.
oButton1:FontStrikeOut := .f.
oButton1:Caption := 'Normal Font'
ENDIF
lFont1 := ! lFont1
RETURN NIL
Need not or can´t ?You need not use any QT object directly.
Actually I do not know what exactly a wrapper is ( have an idea ).Actually, HMG is a wrapper of QT.
Code: Select all
oButton1:oFont := oFont1Code: Select all
oButton1:FontStrikeOut := .F. Code: Select all
::oQTObject:SetFont( ::oFont )Exactly.If I understood, whenever I change some attributes in a control, an associated function is called to manipulate this change and send a message to QT to do this particular change.
Is this what you call a wrapper ?
Because, ::oFont is a class variable and ::FontStrikeOut is a class method. ::oFont is fundamentally a holder of the font object. It will not be applied unless we call setFont( ::oFont ) QT function.In other words, why wrap when I change ::FontStrikeOut and not when I change ::oFont ?
Yes. IMHO, that's why a separate font class is not created. Now also, QT is doing all the jobs.If we do the same thing with both we do not need to write a FONT class to manipulate fonts in HMG4 since the QT one can do all the job...
Ok, I got it.::oFont is a class variable and ::FontStrikeOut is a class method. ::oFont is fundamentally a holder of the font object. It will not be applied unless we call setFont( ::oFont ) QT function.
Yes. IMHO, that's why a separate font class is not created. Now also, QT is doing all the jobs.
METHOD Font SETGET
/*----------------------------------------------------------------------*/
METHOD Font( xValue ) CLASS CONTROL
IF ::lCreated
IF Pcount() == 0
RETURN ::oFont
ELSEIF Pcount() == 1
IF Valtype( xValue ) == "C"
RETURN FontName( xValue )
ELSEIF Valtype( xValue ) == "O"
::oFont := xValue
::oQTObject:SetFont( ::oFont )
ENDIF
ENDIF
ELSE
IF Pcount() == 0
RETURN ::oFont
ELSEIF Pcount() == 1
IF Valtype( xValue ) == "C"
RETURN FontName( xValue )
ELSEIF Valtype( xValue ) == "O"
::oFont := xValue
::oQTObject:SetFont( ::oFont )
ENDIF
ENDIF
ENDIF
RETURN NIL
/*----------------------------------------------------------------------*/