Hi friends
as I anticipated, I wanted to rewrite the portion of source code about menu.
To test simply compile and run.
To avoid collisions with the current system, where necessary, I used the sign L3W (which will be removed if we use it).
The goals I set myself were:
A) get a syntax - and thus a structure - like this: varname1:Caption
B) avoid use of variables in the preprocessor
C) attach menu to its parent and to allow (if possible) inheritance of values
Defects
- after activation of the form, and thus the menu, you can not change its structure and content
- you can not assign names to the elements; names have the form HMGMNU_n
- all that you will find
Merits
- behavior is similar to other HMG objects, inheritance, etc..
For example: the creation of the QT object is determined by the function CreatePendingChildControls of the form (see C)
If this fix will have your approval, the changes - to HMG4 - will be:
1) remove menupopup and menuitem from Hmg4
2) replacement of mainmenu with classes and xxxMENU xxxMNUBAR
3) remove oDefaultMenuItem, aDefaultPopup, nPopupIndex var from window.prg
4) remove these lines from window.prg
Code: Select all
IF ValType( ::oMainMenu ) != 'U'
::oQTObject:setMenuBar( ::oMainMenu:oQTObject )
ENDIF
I hope you want to try what I have achieved. I await your opinions and criticism.
Cheers
p.s. I don't want to be tedious, but once again I would reiterate the need to review the source code of HMG4.
you will notice that in order to manage inheritance and use functions and variables, the class has been derived from both control.prg that window.prg: theoretically, it is not necessary.
Unfortunately, many functions are duplicated (FontName, FontSize, etc..) others lack (Font, FontBold, etc.).
Not always the child object can inherit from his father or it inherits too late.
For example: if I fix a FontName for the form all its children should use this FontName, unless I do not change for the single object.