right-clicking on the TMenuItem

right-clicking on the TMenuItem

Postby Natter » Thu Nov 21, 2024 12:31 pm

Is it possible to handle right-clicking on the TMenuItem object ?
Natter
 
Posts: 1219
Joined: Mon May 14, 2007 9:49 am

Re: right-clicking on the TMenuItem

Postby karinha » Thu Nov 21, 2024 1:21 pm

Maybe:

Code: Select all  Expand view

   SwapMouseButton( 1 ) // For Left-handers
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7822
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: right-clicking on the TMenuItem

Postby Natter » Thu Nov 21, 2024 1:44 pm

I didn't understand. How can I use SwapMouseButton(1 ) ? Any click (both right and left) on the TMenuItem object causes the selection of a menu option. I need to make this choice only on the left click. And use the right click for other purposes.
Natter
 
Posts: 1219
Joined: Mon May 14, 2007 9:49 am

Re: right-clicking on the TMenuItem

Postby karinha » Thu Nov 21, 2024 2:34 pm

Sorry Natter, it was the only idea that occurred to me at the time. Comment what you would do differently, PLS.

Code: Select all  Expand view

// C:\FWH\SAMPLES\NATTER3.PRG

#include "Fivewin.ch"

STATIC cName1

FUNCTION Main()

   LOCAL oWnd

   cName1 := "Test"

   DEFINE WINDOW oWnd

   oWnd:bRClicked  := {| nRow, nCol, nFlags | MyMenu( oWnd, nRow, nCol ) }

   ACTIVATE WINDOW oWnd CENTERED

RETURN NIL

FUNCTION MyMenu( oWnd, nRow, nCol )

   LOCAL oMenu, oItem1, oItem2, oItem3
   LOCAL cName := "Test.."
   LOCAL cName2 := "Test2"

   MENU oMenu POPUP 2007

//    IF lOptionLeft

      SwapMouseButton( 1 ) // For Left-handers

//    ENDIF

      MENUITEM oItem1 PROMPT "Natter Click" ;
          ACTION( oWnd:End() )

      MENUITEM oItem2 PROMPT cName1

      SEPARATOR

      MENUITEM oITem3 PROMPT "Others" ACTION MsgInfo( Len( oMenu:aMenuItems ) )

   ENDMENU

   ACTIVATE POPUP oMenu WINDOW oWnd  AT 140, 10

   SwapMouseButton( 0 )

RETURN( oMenu )

DLL32 FUNCTION SwapMouseButton(swap AS 7) AS 7 PASCAL LIB "USER32.DLL"

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7822
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 44 guests