menusys.prg modification

275 views
Skip to first unread message

Hazael

unread,
Nov 20, 2019, 3:34:14 PM11/20/19
to Harbour Users
Hi friends,

I just want to show you a little modification and ask your opinion.
I think it could be applied to \core-master\src\rtlmenusys.prg 
I just commented line 520 and the result is better than the original version.
A little video of what I did - I think it explains well what I mean.
Please comment.


Mel Smith

unread,
Nov 20, 2019, 5:29:41 PM11/20/19
to Harbour Users
Hi Hazael:
   I think you mean:  Harbour\source\rtl\tmenusys.prg 
-Mel Smith


frank van nuffel

unread,
Nov 21, 2019, 5:27:09 AM11/21/19
to Harbour Users
Hi Hazael,

Warning: this is a complete shot in the dark! but comparing the _o_ceans project implementation with Harbour's, the following 'rather corresponding' code is in use with the _o_ceans project

METHOD Execute() CLASS HBMenuSys

   LOCAL oNewMenu := ::oMenu:getItem( ::oMenu:current )
   LOCAL lPas := .T.
   LOCAL current := 0 // <- added

   // Execute the Data block if selected MenuItem is ! IsPopUp:
   IF HB_ISOBJECT( oNewMenu ) .AND. ! oNewMenu:IsPopUp

      IF IS_IN( ::oMenu:ClassName(), "TOPBARMENU|POPUPMENU|HB_POPUPMENU" )
         SetPos( ::nOldRow, ::nOldCol )
         SetCursor( ::nOldCursor )
         Eval( oNewMenu:data, oNewMenu )
         SetCursor( SC_NONE )
         lPas := .F.
      ENDIF

      // Pop the Menu:
     
      IF popMenu() // <- added
         current := ::oMenu:current // <- added
      ENDIF // <- added

      ::oMenu:select( current ) // <- changed

      // Display newly selected current menu item:
      IF IS_IN( ::oMenu:ClassName(), "POPUPMENU|HB_POPUPMENU" ) .AND. ;
         ::nMenuLevel == 1 .AND. ;
         ! ::oMenu:isOpen

         ::oMenu:open()
      ENDIF

      IF lPas
         ::oMenu:close()
         SetPos( ::nOldRow, ::nOldCol )
         SetCursor( ::nOldCursor )
         Eval( oNewMenu:data, oNewMenu )
         SetCursor( SC_NONE )
      ENDIF

      RETURN oNewMenu:Id
   ENDIF

   RETURN 0
Beware: this code is completely _untested_ with Harbour

frank

Op woensdag 20 november 2019 21:34:14 UTC+1 schreef Hazael:

Hazael

unread,
Nov 22, 2019, 10:55:59 AM11/22/19
to Harbour Users
Hi Frank,

The code you sent does not affect the problem... I do not know why they added those lines but I couldn't see any difference.

 
 

Hazael

unread,
Nov 22, 2019, 10:56:47 AM11/22/19
to Harbour Users
Mel, you are right: \source\rtl\tmenusys.prg 

frank van nuffel

unread,
Nov 24, 2019, 4:20:48 AM11/24/19
to Harbour Users
Hi again,

I'm afraid i've nothing else to go on - as a matter of fact, in _o_ceans the menus are closed (completely) when selecting an option - however, alot of code has been patched for other features (such as hoovering with the mouse; automatic opening of sub-popups), but the codebases differ too much for an easy transcription into Harbour's

Just a question: would closing the menu completely be a better option when selecting a menu item? If yes, supplied code is a pointer in that direction (but pbly it isn't enough; as said, there are many other places in the code where both implementations differ)

Fyi, the _o_ceans implementation is an elaborated version of Clipper's original menusys.prg code

Sorry, i can't be more specific

Best regards,

Frank

Op vrijdag 22 november 2019 16:55:59 UTC+1 schreef Hazael:
Reply all
Reply to author
Forward
0 new messages