FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour right-click Menu for Control
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
right-click Menu for Control
Posted: 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 (fw): Select all Collapse
METHOD LButtonDown()
METHOD LButtonUp()
but nothing for Right Button of Mouse :(

---

do i have to add
Code (fw): Select all Collapse
METHOD HandleEvent()
   ...
   CASE nMsg == WM_RBUTTONDOWN
   CASE nMsg == WM_RBUTTONUP
and build own Method or does Fivewin have a other Way :?:
greeting,

Jimmy
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: right-click Menu for Control
Posted: 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: right-click Menu for Control
Posted: Wed Oct 26, 2022 01: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 (fw): Select all Collapse
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 (fw): Select all Collapse
METHOD RButtonDown( nRow, nCol, nKeyFlags ) CLASS YourClass
Regards



G. N. Rao.

Hyderabad, India
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: right-click Menu for Control
Posted: Thu Oct 27, 2022 03:33 AM
hi,

thx for Answer.

i´m not sure that i understand what you say

i do have use
Code (fw): Select all Collapse
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 (fw): Select all Collapse
METHOD RButtonDown  ( nRow, nCol, nKeyFlags   )   CLASS YourClass
so i need not to handle WM_RBUTTONDOWN :?:
greeting,

Jimmy
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: right-click Menu for Control
Posted: Thu Oct 27, 2022 05: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
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: right-click Menu for Control
Posted: Thu Oct 27, 2022 07:30 AM
hi,
nageswaragunupudi wrote:Yes.
GREAT :D
nageswaragunupudi wrote:Use HandleEvent very sparingly when there is no otherway.
Ok, understood
greeting,

Jimmy

Continue the discussion