Page 1 of 1
right-click Menu for Control
Posted: Wed Oct 26, 2022 12:14 pm
by Jimmy
hi,
when create a CLASS from TControl() i want to add a "right-click Menu"
i do found
but nothing for Right Button of Mouse
---
do i have to add
Code: Select all | Expand
METHOD HandleEvent()
...
CASE nMsg == WM_RBUTTONDOWN
CASE nMsg == WM_RBUTTONUP
and build own Method or does Fivewin have a other Way

Re: right-click Menu for Control
Posted: Wed Oct 26, 2022 12:24 pm
by cnavarro
Use for this DATA bRClicked
Re: right-click Menu for Control
Posted: Wed Oct 26, 2022 1:17 pm
by nageswaragunupudi
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
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
METHOD RButtonDown( nRow, nCol, nKeyFlags ) CLASS YourClass
Re: right-click Menu for Control
Posted: Thu Oct 27, 2022 3:33 am
by Jimmy
hi,
thx for Answer.
i´m not sure that i understand what you say
i do have use
Code: Select all | Expand
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
METHOD RButtonDown ( nRow, nCol, nKeyFlags ) CLASS YourClass
so i need not to handle WM_RBUTTONDOWN

Re: right-click Menu for Control
Posted: Thu Oct 27, 2022 5:37 am
by nageswaragunupudi
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.
Re: right-click Menu for Control
Posted: Thu Oct 27, 2022 7:30 am
by Jimmy
hi,
nageswaragunupudi wrote:Yes.
GREAT
nageswaragunupudi wrote:Use HandleEvent very sparingly when there is no otherway.
Ok, understood