right-click Menu for Control

right-click Menu for Control

Postby Jimmy » Wed Oct 26, 2022 12:14 pm

hi,

when create a CLASS from TControl() i want to add a "right-click Menu"

i do found
Code: Select all  Expand view
METHOD LButtonDown()
METHOD LButtonUp()

but nothing for Right Button of Mouse :(

---

do i have to add
Code: Select all  Expand view
METHOD HandleEvent()
   ...
   CASE nMsg == WM_RBUTTONDOWN
   CASE nMsg == WM_RBUTTONUP

and build own Method or does Fivewin have a other Way :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: right-click Menu for Control

Postby cnavarro » Wed Oct 26, 2022 12:24 pm

Use for this DATA bRClicked
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: right-click Menu for Control

Postby nageswaragunupudi » Wed Oct 26, 2022 1:17 pm

but nothing for Right Button of Mouse


TControl is derived from TWindow.
You need to search both TControl and TWindow classes.

You can see from TWindow class
Code: Select all  Expand view
METHOD RButtonDown( nRow, nCol, nKeyFlags ) CLASS TWindow

   if ::bRClicked != nil
      Eval( ::bRClicked, nRow, nCol, nKeyFlags, Self )
   endif

return nil

//----------------------------------------------------------------------------//

METHOD RButtonUp( nRow, nCol, nKeyFlags ) CLASS TWindow

   if ::bRButtonUp != nil
      Eval( ::bRButtonUp, nRow, nCol, nKeyFlags, Self )
   endif

return nil

//----------------------------------------------------------------------------//
 


That means, you need to add method

Code: Select all  Expand view
METHOD RButtonDown( nRow, nCol, nKeyFlags ) CLASS YourClass
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: right-click Menu for Control

Postby Jimmy » Thu Oct 27, 2022 3:33 am

hi,

thx for Answer.

i´m not sure that i understand what you say

i do have use

Code: Select all  Expand view
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TGrid  

   DO CASE
      //  use for LVS_OWNERDRAWFIXED
      CASE nMsg == WM_MEASUREITEM
      CASE nMsg == WM_DRAWITEM
      // add for Context Menu
      CASE nMsg == WM_RBUTTONDOWN
         IF ::bRbClick != nil
            EVAL( ::bRbClick, ::oWnd, Self )
         ENDIF
      CASE nMsg == WM_RBUTTONUP
   ENDCASE

RETURN ::Super:HandleEvent( nMsg, nWParam, nLParam )


now you say i "just" need to "override"
Code: Select all  Expand view
METHOD RButtonDown  ( nRow, nCol, nKeyFlags   )   CLASS YourClass

so i need not to handle WM_RBUTTONDOWN :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: right-click Menu for Control

Postby nageswaragunupudi » Thu Oct 27, 2022 5:37 am

now you say i "just" need to "override"
Code:
METHOD RButtonDown ( nRow, nCol, nKeyFlags ) CLASS YourClass

so i need not to handle WM_RBUTTONDOWN :?:



Yes.

Wherever the parents have standard methods, you override them in your class and if needed return calling Super method.
Use HandleEvent very sparingly when there is no otherway.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10625
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: right-click Menu for Control

Postby Jimmy » Thu Oct 27, 2022 7:30 am

hi,
nageswaragunupudi wrote:Yes.

GREAT :D
nageswaragunupudi wrote:Use HandleEvent very sparingly when there is no otherway.

Ok, understood
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 28 guests