diff --git a/harbour/contrib/hgf/win32/tmenu.prg b/harbour/contrib/hgf/win32/tmenu.prg index 24f47753b2..10ad97b93e 100644 --- a/harbour/contrib/hgf/win32/tmenu.prg +++ b/harbour/contrib/hgf/win32/tmenu.prg @@ -59,8 +59,9 @@ CLASS TMenu DATA nHandle DATA aItems - METHOD New( oForm ) - METHOD Add( oMenuItem ) + METHOD New( oForm ) // Creates a new menu + METHOD Add( oMenuItem ) // Adds a menuitem + METHOD FindItem( nId ) // Searches for a sub menuitem given its id ENDCLASS @@ -80,3 +81,21 @@ METHOD Add( oMenuItem ) CLASS TMenu AAdd( ::aItems, oMenuItem ) return nil + +METHOD FindItem( nId ) CLASS TMenu + + local oMenuItem, n + + for n = 1 to Len( ::aItems ) + if ( oMenuItem := ::aItems[ n ] ):nId == nId + return oMenuItem + else + if oMenuItem:aItems != nil + if ( oMenuItem := oMenuItem:FindItem( nId ) ) != nil + return oMenuItem + endif + endif + endif + next + +return oMenuItem \ No newline at end of file diff --git a/harbour/contrib/hgf/win32/tmenuitm.prg b/harbour/contrib/hgf/win32/tmenuitm.prg index 337647ca0c..8fefa16f56 100644 --- a/harbour/contrib/hgf/win32/tmenuitm.prg +++ b/harbour/contrib/hgf/win32/tmenuitm.prg @@ -57,7 +57,8 @@ CLASS TMenuItem DATA cCaption // Specifies the text of the menu item - DATA cAction // A character description of the method to invoke + DATA cName // The name of this component + DATA OnClick // A character description of the method to invoke DATA nId // Command value to send to the container form DATA lEnabled // Specifies whether the menu item is enabled DATA aItems // Contains the menu items in the submenu of the menu item @@ -68,6 +69,7 @@ CLASS TMenuItem METHOD New( oOwner ) // Creates a new menu item METHOD Add( oMenuItem ) // Adds a new drop down menu item + METHOD FindItem( nId ) // Searches for a sub menuitem given its id ENDCLASS @@ -93,4 +95,22 @@ METHOD Add( oMenuItem ) CLASS TMenuItem oMenuItem:oParent = Self AAdd( ::aItems, oMenuItem ) -return nil \ No newline at end of file +return nil + +METHOD FindItem( nId ) CLASS TMenuItem + + local oMenuItem, n + + for n = 1 to Len( ::aItems ) + if ( oMenuItem := ::aItems[ n ] ):nId == nId + return oMenuItem + else + if oMenuItem:aItems != nil + if ( oMenuItem := oMenuItem:FindItem( nId ) ) != nil + return oMenuItem + endif + endif + endif + next + +return oMenuItem \ No newline at end of file