No HMG4 Font object

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: No HMG4 Font object

Post by concentra »

And Luigi, in the way I suggested the LABEL class could be:

Code: Select all

#include "hbclass.ch"
#include "common.ch"
#include "hbqtgui.ch"
#include "hmg.ch"

/*----------------------------------------------------------------------*/

CLASS LABEL FROM CONTROL

   // Internal Data
   DATA lAutoSize                                 INIT   .F.
   DATA cValue                                    INIT   ''
   DATA lWordWrap                                 INIT   .T.
   DATA nAlignment                                INIT   Qt_AlignAbsolute

   // Properties
   METHOD AutoSize                                SETGET
   METHOD Value                                   SETGET
   METHOD WordWrap                                SETGET
   METHOD Alignment                               SETGET
   METHOD VAlignment                              SETGET

   // Methods
   METHOD Create( oParentQtObject )
   METHOD New()

ENDCLASS

/*----------------------------------------------------------------------*/

METHOD AutoSize( lValue ) CLASS LABEL
  LOCAL oFM

   IF Pcount() == 0
      RETURN ::lAutoSize
   ELSEIF Pcount() == 1
      IF lValue
         oFM        := QFontMetrics( ::oFont )
         Self:Width := oFM:width( ::cValue )
      ENDIF
      ::lAutoSize := lValue
   ENDIF

   RETURN NIL

/*----------------------------------------------------------------------*/

METHOD Value( cValue ) CLASS LABEL

   IF Pcount() == 0
      RETURN ::oQTObject:Text()
   ELSEIF Pcount() == 1
      ::oQTObject:setText( cValue )
      ::cValue := cValue
      IF ::lAutoSize
         // update width of label
         Self:AutoSize   := ::lAutoSize
      ENDIF
   ENDIF

   RETURN NIL

/*----------------------------------------------------------------------*/

METHOD Create( oParentQtObject ) CLASS LABEL

   IF valtype( ::oContainer ) == 'U'
      ::oQTObject:SetParent(oParentQtObject)
   ELSE
      ::oQTObject:SetParent(::oContainer)
   ENDIF

   ::oParent:AddData( ::cName , Self )

   // Setting '::lCreated' flag, so, runtime properties can be invoked
   ::lCreated := .T.

   // Set Properties
   IF ValType( ::cValue )     != 'U'; Self:Value         := ::cValue     ; ENDIF
   IF ValType( ::nRow )       != 'U'; Self:Row           := ::nRow       ; ENDIF
   IF ValType( ::nCol )       != 'U'; Self:Col           := ::nCol       ; ENDIF
   IF ValType( ::nWidth )     != 'U'; Self:Width         := ::nWidth     ; ENDIF
   IF ValType( ::nHeight )    != 'U'; Self:Height        := ::nHeight    ; ENDIF
   IF ValType( ::cFontName )  != 'U'; Self:FontName      := ::cFontName  ; ENDIF
   IF ValType( ::nFontSize )  != 'U'; Self:FontSize      := ::nFontSize  ; ENDIF
   IF ValType( ::lBold )      != 'U'; Self:FontBold      := ::lBold      ; ENDIF
   IF ValType( ::lItalic )    != 'U'; Self:FontItalic    := ::lItalic    ; ENDIF
   IF ValType( ::lUnderline ) != 'U'; Self:FontUnderline := ::lUnderline ; ENDIF
   IF ValType( ::lStrikeout ) != 'U'; Self:FontStrikeOut := ::lStrikeout ; ENDIF
   IF ValType( ::cToolTip )   != 'U'; Self:ToolTip       := ::cToolTip   ; ENDIF
   IF ValType( ::lTabStop )   != 'U'; Self:TabStop       := ::lTabStop   ; ENDIF
   IF ValType( ::aFontColor ) != 'U'; Self:FontColor     := ::aFontColor ; ENDIF
   IF ValType( ::aBackColor ) != 'U'; Self:BackColor     := ::aBackColor ; ENDIF
   IF ValType( ::lWordWrap )  != 'U'; Self:WordWrap      := ::lWordWrap  ; ENDIF
   IF ValType( ::lAutoSize )  != 'U'; Self:AutoSize      := ::lAutoSize  ; ENDIF

   // set default label word wrapping to .T.
   // Self:WordWrap := .T.

   // Set Font & Show Object

   ::oQTObject:SetFont( ::oFont )
   ::oQTObject:show()

   RETURN Self

/*----------------------------------------------------------------------*/

METHOD NEW() CLASS LABEL

   super:new()

   ::oQTObject := QLabel()
   ::oFont     := QFont()

   RETURN Self

/*----------------------------------------------------------------------*/

METHOD WordWrap( lValue ) CLASS LABEL

   IF Pcount() == 0
      RETURN ::oQTObject:WordWrap()
   ELSEIF Pcount() == 1
      ::lWordWrap := lValue
      ::oQTObject:SetWordWrap( lValue )
   ENDIF

   RETURN NIL

/*----------------------------------------------------------------------*/

METHOD Alignment( nAlign ) CLASS LABEL
   LOCAL nSet, nRet := LBL_LEFT

   // we need convert different numbers FOR alignment in HMG and QT
   IF Pcount() == 0
      // reset horizontal alignment settings
      nSet := numAND( ::oQTObject:Alignment(),0x0F )
      DO CASE
         CASE nSet == Qt_AlignLeft
            RETURN LBL_LEFT
         CASE nSet == Qt_AlignHCenter
            RETURN LBL_CENTER
         CASE nSet == Qt_AlignRight
            RETURN LBL_RIGHT
      ENDCASE
   ELSEIF Pcount() == 1
      // FOR compatibility with future vertical alignment
      // first read Alignment and reset horizontal alignment
      nSet := numAND( ::oQTObject:Alignment(),0xF0 )
      DO CASE
         CASE nAlign == LBL_LEFT
            nSet := numXOR( nSet, Qt_AlignLeft )
            nRet   := LBL_LEFT
         CASE nAlign == LBL_CENTER
            nSet := numXOR( nSet, Qt_AlignHCenter )
            nRet   := LBL_CENTER
         CASE nAlign == LBL_RIGHT
            nSet := numXOR( nSet, Qt_AlignRight )
            nRet := LBL_RIGHT
      ENDCASE
      ::oQTObject:SetAlignment( nSet )
      ::nAlignMent := nSet
   ENDIF

   RETURN nRet

/*----------------------------------------------------------------------*/

METHOD VAlignment( nAlign ) CLASS LABEL
   LOCAL nSet, nRet := LBL_VCENTER

   // we need convert different numbers FOR alignment in HMG and QT
   IF Pcount() == 0
      // reset vertical alignment settings
      nSet := numAND( ::oQTObject:Alignment(),0xF0 )
      DO CASE
         CASE nSet == Qt_AlignTop
            RETURN LBL_TOP
         CASE nSet == Qt_AlignVCenter
            RETURN LBL_VCENTER
         CASE nSet == Qt_AlignBottom
            RETURN LBL_BOTTOM
      ENDCASE
   ELSEIF Pcount() == 1
      // FOR compatibility with future vertical alignment
      // first read Alignment and reset horizontal alignment
      nSet := numAND( ::oQTObject:Alignment(),0x0F )
      DO CASE
         CASE nAlign == LBL_TOP
            nSet   := numXOR( nSet, Qt_AlignTop )
            nRet   := LBL_TOP
         CASE nAlign == LBL_VCENTER
            nSet := numXOR( nSet, Qt_AlignVCenter )
            nRet   := LBL_VCENTER
         CASE nAlign == LBL_BOTTOM
            nSet := numXOR( nSet, Qt_AlignBottom )
            nRet   := LBL_BOTTOM
      ENDCASE
      ::oQTObject:SetAlignment( nSet )
      ::Alignment := nSet
   ENDIF

   RETURN nRet

/*----------------------------------------------------------------------*/
And the Demo_4 will not crash at start.
Note that this was a 2 minutes job and may have bugs !
[[]] Mauricio Ventura Faria
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: No HMG4 Font object

Post by l3whmg »

Hi Mauricio,
now we have the same opinion and we are talking the same language :mrgreen:
Ok, I understood that ::oParent is an HMG object, but the time control´s NEW() method is called, ::oParent don´t have a QT object associated and it´s not possible to instantiate a control´s QT object referencing the associated parent QT object.
In the suggestion I presented, the control class instantiates the QT object earlier, in the NEW() method, without associating it with the corresponding QT object.
The association will be made later, in the window class´s ACTIVATE() method, replacing the actual mode of instantiating controls and preserving compatibility with the actual code.
I'm in agreement with you: it's the same of my experiment!
In pseudo-code
QTApplication started
::oDefaultParent := NIL
HMG formNew(): here ::oDefaultParent it's HmgFormObject and ::oQtObject is QtObject-QmainWindow
HMG buttonNew(): here ::oParent := ::oDefaultParent := HmgFormObject and ::oQtObject is QtObject-QPushbutton( ::oParent:oQtobject )
As you can see, in the last row about button, in New method I create a QtObject and assign its parent. How can I do?
With ::oParent:oQtObject. ::oParent it's HmgFormObject and ::oQtObject is its QTobject.
for this reason
HmgObjectButton::oFont := ::oParent:oQtObject:Font()
and then
QTObjectButton:SetFont(::oFont)
Et voila: we have default font for button and it's like form and we can prevent font problems.
Ok we are togheter!
I do a mistake or it's my POW: I wanna try to have - automatically - parent between forms! But now, I don't know if it's a good idea.
Cheers
p.s. we must have this syntax: formname:<controlname>:<property | method> and these are HMG object
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: No HMG4 Font object

Post by l3whmg »

Hi Mauricio,
I read your last post but at the same time I send my post :lol:
A little think for me: why do you write super:New() :?:

Cheers
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: No HMG4 Font object

Post by l3whmg »

Hi Mauricio,
these are little example from my HMG experiment:

A) this is like control.prg but there isn't NEW() method. Every object has its NEW() method

Code: Select all

CLASS HMGBASEOBJ

   DATA oQtObject                                 INIT NIL

// generic Data
   DATA lActivated                                INIT .F.
   DATA nAlignDir                                 INIT Qt_AlignAbsolute
   DATA nAlignHor                                 INIT Qt_AlignLeft
   DATA nAlignVer                                 INIT Qt_AlignVCenter
   DATA lAutoSize                                 INIT .F.
   DATA lAutoFillBackground                       INIT .T.
   DATA aBackColor                                INIT { 255, 255, 255, 255 }
   DATA cCaption                                  INIT NIL
   DATA nCol                                      INIT NIL
   DATA aChilds                                   INIT {}
   DATA lEnabled                                  INIT .T.
   DATA lFlat                                     INIT .F.
   DATA oFont                                     INIT NIL
   DATA aFontColor                                INIT { 0, 0, 0, 255 }
   DATA cFontName                                 INIT NIL
   DATA nFontSize                                 INIT NIL
   DATA lFontBold                                 INIT NIL
   DATA lFontItalic                               INIT NIL
   DATA lFontUnderLine                            INIT NIL
   DATA lFontStrikeout                            INIT NIL
..........etc, etc, etc
// Methods
   METHOD AddChild
   METHOD AddData
   METHOD Center
   METHOD CreatePendingChildControls
   METHOD Hide
   METHOD SetAlign
   METHOD Show

// Properties
   METHOD AlignH                                  SETGET
   METHOD AlignV                                  SETGET
   METHOD BackColor                               SETGET
   METHOD ChildList                               INLINE ::aChilds
   METHOD Col                                     SETGET
   METHOD Flat                                    SETGET
   METHOD Font                                    SETGET
   METHOD FontColor                               SETGET
   METHOD FontName                                SETGET
   METHOD FontSize                                SETGET
   METHOD FontBold                                SETGET
   METHOD FontItalic                              SETGET
   METHOD FontUnderLine                           SETGET
   METHOD FontStrikeout                           SETGET
..........etc, etc, etc
/*---------------------------------------------------------------
 Font
 ---------------------------------------------------------------*/
METHOD HMGBASEOBJ:Font( oArg1 )

   IF PCOUNT() == 0
      RETURN ::oFont
   ELSEIF VALTYPE( oArg1 ) == "O"
      ::oFont := oArg1
      ::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()
   ENDIF

RETURN NIL
..........etc, etc, etc
B) This is for LABEL

Code: Select all

CLASS HMGLABLE FROM HMGBASEOBJ, HMGBASEINIT

// Methods
   METHOD Activate
   METHOD Create
   METHOD New

// Properties
   METHOD AutoSize                                SETGET
   METHOD Caption                                 SETGET
   METHOD Picture                                 SETGET

ENDCLASS
/*................................................................
 Methods - section
 ................................................................*/

/*---------------------------------------------------------------
 Activate
 ---------------------------------------------------------------*/
METHOD HMGLABLE:Activate()

// TO prevent more time activation
   IF ::lActivated == .T.
      RETURN NIL
   ENDIF

   ::Create()
   ::lActivated := .T.

// Show QtObject if visible
   IF ::lVisible == .T. ; ::oQTObject:Show() ; ELSE ; ::oQTObject:Hide() ; ENDIF

RETURN NIL

/*---------------------------------------------------------------
 Create
 ---------------------------------------------------------------*/
METHOD HMGLABLE:Create()

// TO prevent more time creation
   IF ::lActivated == .T.
      RETURN NIL
   ENDIF

// TO prevent use without QT starting
   IF ::lQtStarted == .F.
      HMGAPPLICATION():Start()
   ENDIF

// TODO HMG errors
   IF ::lStdError == .T.
      ::sQtApplication:Exit()
      ::sQtApplication:Quit()
// TODO HmgStdErr LOG
      QUIT
   ENDIF

// add HmgObject to its parent
   ::oParent:AddData( ::cName , Self )

RETURN NIL

/*---------------------------------------------------------------
 New
 ---------------------------------------------------------------*/
METHOD HMGLABLE:New( oParent )

// set-up a default name
   ::cName          := '_HMG_OBJECT_' + hb_ntos( ::nObjectCounter++ )
// set-up parent in this order: parameter, current or default (last one is Qt QApplication():DeskTop()
   ::oParent := IF( hb_IsObject( oParent ), oParent, IF( hb_IsObject( ::oCurrentParent ), ::oCurrentParent, ::oDefaultParent ) )
// add this HMG object to its parent
   ::oParent:AddChild( Self )
// create QT object with its parent
   ::oQtObject := QLabel( ::oParent:Qtobject() )
// inherit properties
   ::Font( ::oParent:QtObject:Font() )

   ::oQtObject:setAutoFillBackground( ::lAutoFillBackground )

RETURN Self

/*................................................................
 Properties - section
 ................................................................*/

/*---------------------------------------------------------------
 AutoSize
 ATTENTION: if you want different Font properties you MUST change font properties BEFORE and then use it else doesn't work
 ---------------------------------------------------------------*/
METHOD HMGLABLE:AutoSize( lArg1 )

   LOCAL oFontMetrics, nWidth

   IF PCOUNT() == 0
      RETURN ::lAutoSize
   ELSEIF VALTYPE( lArg1 ) == "L"
      ::lAutoSize := lArg1
      oFontMetrics := QFontMetrics( ::oFont )
      nWidth   := oFontMetrics:width( ::cCaption )
      ::Width( nWidth )
   ENDIF

RETURN NIL

/*---------------------------------------------------------------
 Caption
 ---------------------------------------------------------------*/
METHOD HMGLABLE:Caption( cArg1 )

   IF PCOUNT() == 0
      RETURN ::cCaption
   ELSEIF VALTYPE( cArg1 ) == "C"
      ::cCaption := cArg1
      ::oQTObject:setText( ::cCaption )
   ENDIF

RETURN NIL

/*---------------------------------------------------------------
 Picture
 ---------------------------------------------------------------*/
METHOD HMGLABLE:Picture( cArg1 )

//   LOCAL oImage, oPixMap

   IF PCOUNT() == 0
      RETURN ::cPicture
   ELSEIF VALTYPE( cArg1 ) == "C"
      ::cPicture := cArg1
//      oImage := QImage( cArg1 )
//      oPixmap := QPixmap():fromImage( oImage )
 //     ::oQTObject:setPixmap( HMGMISC():MergeSideBySide( oPixmap, ::cCaption, ::oFont ) )
      ::oQTObject:setText( "<img src='" + ::cPicture + "'>" + ::cCaption )
   ENDIF

RETURN NIL

C) and this one can be form Take a look: form is inherit from HMGBASEOBJ like lable.....

Code: Select all

CLASS HMGWINDOW FROM HMGBASEOBJ, HMGBASEINIT

// Methods
   METHOD Activate
   METHOD Create
   METHOD EndWindow
   METHOD New
   METHOD Release

ENDCLASS

/*---------------------------------------------------------------
 Activate
 ---------------------------------------------------------------*/
METHOD HMGWINDOW:Activate()

// TO prevent more time activation
   IF ::lActivated == .T.
      RETURN NIL
   ENDIF

   ::Create()
   ::lActivated := .T.

// Show QtObject
   ::oQTObject:Show()

// Start Qt handling
   ::sQtApplication:Exec()

RETURN NIL

/*---------------------------------------------------------------
 Create
 ---------------------------------------------------------------*/
METHOD HMGWINDOW:Create()

// TO prevent more time creation
   IF ::lActivated == .T.
      RETURN NIL
   ENDIF

// TO prevent use without QT starting
   IF ::lQtStarted == .F.
      HMGAPPLICATION():Start()
   ENDIF

// TODO HMG errors
   IF ::lStdError == .T.
      ::sQtApplication:Exit()
      ::sQtApplication:Quit()
// TODO HmgStdErr LOG
      QUIT
   ENDIF

// add HmgObject to its parent
   ::oParent:AddData( ::cName , Self )

// connecting default event
   IF ::nFormType == WND_MAIN
      IF VALTYPE( ::bOnRelease ) <> "B"
         ::oQTObject:disconnect( QEvent_Close )
         ::oQTObject:connect( QEvent_Close , {|| ::sQtApplication:Quit() } )
      ENDIF
   ELSEIF ::nFormType == WND_MODAL
      IF VALTYPE( ::bOnRelease ) <> "B"
         ::oQtObject:windowModality( Qt_ApplicationModal )
         ::oQTObject:disconnect( QEvent_Close )
         ::oQTObject:connect( QEvent_Close , {|| ::oQTObject:Exit(), ::oQTObject:Quit() } )
      ENDIF
   ENDIF

// create child controls
   ::CreatePendingChildControls()

RETURN NIL

/*---------------------------------------------------------------
 EndWindow
 ---------------------------------------------------------------*/
METHOD HMGWINDOW:EndWindow()

   ::oDefaultParent := NIL

RETURN NIL

/*---------------------------------------------------------------
 New
 ---------------------------------------------------------------*/
METHOD HMGWINDOW:New( oParent )

// set-up a default name
   ::cName          := '_HMG_OBJECT_' + hb_ntos( ::nObjectCounter++ )
// set-up parent in this order: parameter, current, default (last one is Qt QApplication():DeskTop()
   ::oParent := IF( hb_IsObject( oParent ), oParent, IF( hb_IsObject( ::oCurrentParent ), ::oCurrentParent, ::oDefaultParent ) )
// add this HMG object to its parent
   ::oParent:AddChild( Self )
// create QT object with its parent
   ::oQtObject := QMainWindow( ::oParent:QtObject )
// form it's now the current parent
   ::oCurrentParent := Self
// inherit properties
   ::Font( ::oParent:QtObject:Font() )
// Create system tray icon
   ::oSystemTrayIcon := QSystemTrayIcon( ::oQTObject )
// Set the focus policy to capture focus and keyboard events.
   IF ::oQTObject:focusPolicy() == Qt_NoFocus
      ::oQTObject:setFocusPolicy( Qt_StrongFocus )
   ENDIF

RETURN Self
Luigi from Italy
www.L3W.it
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: No HMG4 Font object

Post by concentra »

HI Luigi,
l3whmg wrote:A little think for me: why do you write super:New() :?:
The NEW() method of the LABEL class overrides the NEW() method of the superclass LABEL inherits from, CONTROL.
But the code in the NEW() method of the superclass, CONTROL, must run in order to set the controlling stuff and so I called it.
When a method is override in an inherited class the superclass overrrided method only runs when called explicitly.
The way HMG is coded today, without a NEW() class for LABEL ( and etc... ) the superclass NEW() is executed whenever a LABEL:NEW() is called.
[[]] Mauricio Ventura Faria
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: No HMG4 Font object

Post by l3whmg »

Hi Mauricio,
you are right! I had forgotten this aspect because I was thinking based on my experiment, which is different.
Many thanks.
Cheers
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: No HMG4 Font object

Post by l3whmg »

Hello everyone.
I wanted to continue with the experiment of my library, because I was curious to know if I could solve some problems or how to use HbQt better :mrgreen:

I managed to use the "ACTIVATE WINDOW ALL", I was able to handle the keyboard input using "SETINPUTMASK" of the Qt library, and then the ability to edit numeric fields in Italian (123,456.789) and English (123,456.789). A seeing is not very nice, but this is what Qt can do - if I understand correctly -. I made a simple parser for stylesheet, groped to resolve some overlapping of the code.

I think it's worth taking a look at these sources: "window_std\wnd_demo2.prg" and "textbox\tbx_demo1.prg" ;)

The organization is quite similar to the official HMG4 version 8-)
  • - HmgBaseInit, HmgBaseObject: the first contains a class of shared data, the second contains data and generalized method - used by both forms that controls -.
  • - HmgApplication In my opinion it is better to have a start-up. I also create a public var "HmgWindows" that will contain all the forms with the appropriate degree of kinship.
  • - HmgButton, HmgLabel, HmgMessageBox, HmgTextbox, HmgWindow are modules that operate on objects
  • - HmgResource, HmgMisc resources and utilities
If you would like to build you must first: :!:
- edit the file qt.conf, should point to the directory "plugins/imageresources"
- edit the files. hbp changing the path of hbqt.hbc
- copy the file QtCore4.dll, QtGui4.dll, QtNetwork4.dll where the executable resides
Of course, you should not include HMG4!

Well, I hope that what I have tried to realize it may be useful :D

Cheers
Attachments
Hmg-L3wPow-Gui.zip
sources
(82.91 KiB) Downloaded 258 times
Luigi from Italy
www.L3W.it
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: No HMG4 Font object

Post by concentra »

Hi Luigi, me again !

I planed to back this topic after my commits but you was faster ! 8-)

So we agree that some changes must be done in order to make an appropriate evolution of the lib, and my first concern is about instantiating the associated QT objects as soon as possible. I suppose this is one of your too.
I know that this isn´t the only one in your vision but, at this moment, mine is shorter.
Why ? Because I am new to HMG4 and I am not so comfortable with big changes in it.
Your posts here was a big help to me in understanding some of the lib behaviors ! :mrgreen:
I didn´t payed a big attention in your experimental code, only a superficial inspection, very sorry ! I will make a deeper view in it now and will be back to comment.

Backing in what I proposed to change in the window class in order to make possible to instantiate the QT objects earlier in the controls, I changed the path and instantiated the window associated QT object in the NEW method of the window class. I move 1 single line in window.prg, so this was a very small change and, smaller the change, smaller the chance to break something...

I tested all samples in order to see if this was OK and found no problems. In fact some samples behaved better !

Remember the "samples\label\demo_4.prg" problem with AUTOSIZE method in label.prg ?
I also changed the label class the way I proposed and the problem in samples\label\demo_4.prg went away.

And because the container object, the window, was also instantiated earlier, the oFont issue also went away, because the font is inherited from the container window that is already instantiated.

A side effect is that I had to make the same changes in image class because it inherits from label, but this was a very easy and fast task and I am confident that this must be done in all classes.

I committed the changes so, could you please update and do some tests to see if something can goes wrong ?
[[]] Mauricio Ventura Faria
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: No HMG4 Font object

Post by l3whmg »

Hi Mauricio,
many thanks for your job. Yes, I'll donwload and I'll do test.

What you have done, confirm me and other opinion.
I don't want to be boring, but I think it's most important to have a good core than write a lot and what you wrote (demo problem, font inherit, etc.) confirm this.

Brief explanation of the logic that I used: QT object is instantiated inside the new method of the HMG object (every object has its new method) but it's not yet qualified. The create method specializes the object based upon the properties. The create method is run from ACTIVATE. Another difference with Hmg4: I create a starter. In this way I can have a big class that is QApplication. Main form inherit properties from QApplication:Desktop (font and other), label inherit properties from form and, if exist, sub-label control inherit from label and so on.

Well, I come back on video editing for my childrens :shock:

Cheers
Luigi from Italy
www.L3W.it
Post Reply