Hi Roberto,
Roberto Lopez wrote:
I mean that Semi-oop in HMG.4 should work without using -DHMG3 or hmg_compatibility() or any other artifact. These things should be required only for HMG3 compatibility.
here I need to explain a bit.
semi-oop works without -DHMG3 and without hmg_compatibility( .T. ) if we follow "HMG4 rules".
Example:
DEFINE WINDOW Test
In HMG3 and 4 Test is a public variabile. In HMG4 is an OBJECT. And so we can call methods directly
Test:setFocus() is the standard harbour way.
Test.setFocus() is supported since we preprocess . => :
Test.setFocus NEEDS -DHMG3
With this #define we force loading of hmg3.ch where a very clever, compile-time directive creates a series of xtranslate specific to Test window !
I ported hmg3.ch this summer from hmg3 source code. Original file was translating hmg3 false oop to helper functions like doMethod, Set/GetProperty etc etc that in the end simulated an OOP environment. I started to convert (I did not complete) to pure OOP calls.
Code: Select all
#xtranslate <w> . \<p:Activate,Center,Release,Maximize,Minimize,Restore,Show,Hide,SetFocus,Print,Capture> \[()\] => <w>:\<p\>() ;;
Perhaps we should evauate if it is possible to complete the porting and then make these xtranslate mandatory so that we can drop the . => : conversion that has some bad side-effects
From what I have seen in some hmg3 code sent to me, sometimes doMethod and Set/GetProperties are used directly in the code, so I needed to create some mockups for them...
Unfortunately some of the hmg3 functions are very complex, with nested IFs, depending on object type, numer of parameters etc etc. Up to now I have something simple like:
Code: Select all
FUNCTION GetProperty( cWindow , cControl , cProperty, nIndex )
IF pcount() == 3
RETURN &cWindow:&cControl:&cProperty
ELSEIF pcount() == 4
RETURN &cWindow:&cControl:&cProperty( nIndex )
ENDIF
msgQuit( "getProperty called with "+str(pcount())+" parameters not implemented" )
RETURN NIL
but probably we may solve in some other way but an hmg3 core code expert is needed.... or we may request programmers to change ther source code !!!
About hmg3_compatibility.
Imagine a form F with a tab TAB with a tabpage TP with a button BTN.
In hmg3 you can access BTN directly from the form with:
F.BTN.setFocus
In hmg4 you must access BTN with:
F:TAB:TP:BTN:setFocus()
It's longer but it allows to have buttons with the same name in different tabs. Trust me, it may be needed....
Since it breaks compatibility, if we require STRICT hmg3 compatibility (if programmers refuse to adapt their programs) the objects in a tabpage, in a toolbar, in a menupopup, a contextmenu and dropdownmenu are also "added" to their MAIN/CHILD/MODALWINDOW or DIALOG. So F:BTN:setFocus() works in hmg4...
The other point where the flag is used is in combobox, where height in Qt has a completely different meaning respect to win32....
So, in conclusion, we should take a very strong decision: in HMG4 what is "official", "supported", "deprecated".
IF (ipotesis) OOP is official, semioop supported and xbase syntax deprecated we may start to shuffle hmg[3].ch contents to separate the 3 programming styles... but a couple of questions:
is semioop or xBase ? I think it is both....
is semioop or xBase ? It is semioop while SETFOCUS n TO w is xbase (not implemented in hmg4)
... message is too long... I stop here
![Smile :-)](./images/smilies/icon_e_smile.gif)
)))