I'm trying to find solution for some problems and for this reason I create a little fork of HMG4 with copy and paste.
I think I've found a problem or perhaps I can't understand the source code. Can you help me?
Problem: when we add the current object to its parent (to use syntax FormName:Control), I think we add two times the same object with different names.
Example: button.
Code from button.prg
Code: Select all
METHOD New( oParent ) CLASS BUTTON
Super:New( oParent ) ====>0
::oQTObject := QPushButton( ::oParent:oQTObject )
::oFont := ::oQTObject:Font()
::oParent:AddData( ::cName , Self ) ====>1
Code: Select all
METHOD New( oParent ) CLASS CONTROL
IF !::lGridCellFlag
::nObjectCounter++
::cName := '_HMG_OBJECT_' + AllTrim( Str( Int( ::nObjectCounter ) ) ) ====>0
====>1 Here, we add the object named _HMG_OBJECT_xxxxxxx to its parent (ie now we can use FormName:_HMG_OBJECT_xxxxxxx)
Code from basic.prg
Code: Select all
METHOD Name( cValue ) CLASS BASIC
IF Pcount() == 0
RETURN ::cName
ELSEIF Pcount() == 1
IF ::cName != cValue
::cName := cValue
::oParent:AddData( ::cName, Self ) ====> 2
source code WITHOUT use of :Name method
Code: Select all
WITH OBJECT oWin := Window():New()
WITH OBJECT Button():New()
END WITH
END WITH
source code WITH use of :Name method
Code: Select all
WITH OBJECT oWin := Window():New()
WITH OBJECT Button():New()
:Name := "Button1"
END WITH
END WITH
My analysis is correct or is a misunderstanding? If it's correct, IMHO we have the risk of unnecessarily fill the memory.
Best regards and many thanks in advance for any help.