Dear All,
How to determine if the popup menu of button was pressed or clicked by mouse?
I would like to alter instead of menu popup.. say xbrowse( 'table' )..
Can somebody point me the way..
Regards,
Frances
How to determine if the popup menu of button was pressed or clicked by mouse?
if lClick
if ::oPopup != nil
do case
case ::nTypeButton == TYPE_SPLITPOPUP
if nRow >= ::nPopupMargin .or. ! lAction
oWnd := ::oWnd
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nTop + ::nHeight() + ;
If( GetClassName( GetParent( GetParent( ::hWnd ) ) ) != "TRPANEL",;
oWnd:nHeight(), 0 ), ::nLeft, oWnd, .F. )
oWnd:oPopup = nil
::Refresh()
else
::click()
endif
case ::nTypeButton == TYPE_POPUP
if nCol >= ::nPopupMargin .or. !lAction
oWnd := ::oWnd
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nTop + ::nHeight() + ;
If( GetClassName( GetParent( GetParent( ::hWnd ) ) ) != "TRPANEL",;
If( ! oWnd:IsKindOf( "TRIBBONBAR" ), oWnd:nHeight(), 0 ), 0 ),;
::nLeft - If( ! oWnd:IsKindOf( "TRBGROUP" ), oWnd:nLeft, 0 ), oWnd, .F. )
oWnd:oPopup = nil
::Refresh()
else
::click()
endif
Enrico Maria Giordano wrote:If I understood correctly, you can use the ACTION clause.
EMG
nageswaragunupudi wrote:How to determine if the popup menu of button was pressed or clicked by mouse?
This click is handled in METHOD LButtonUp() in TRBtn.Prg. Here is the relevant portion of the code:
- Code: Select all Expand view
if lClick
if ::oPopup != nil
do case
case ::nTypeButton == TYPE_SPLITPOPUP
if nRow >= ::nPopupMargin .or. ! lAction
oWnd := ::oWnd
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nTop + ::nHeight() + ;
If( GetClassName( GetParent( GetParent( ::hWnd ) ) ) != "TRPANEL",;
oWnd:nHeight(), 0 ), ::nLeft, oWnd, .F. )
oWnd:oPopup = nil
::Refresh()
else
::click()
endif
case ::nTypeButton == TYPE_POPUP
if nCol >= ::nPopupMargin .or. !lAction
oWnd := ::oWnd
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nTop + ::nHeight() + ;
If( GetClassName( GetParent( GetParent( ::hWnd ) ) ) != "TRPANEL",;
If( ! oWnd:IsKindOf( "TRIBBONBAR" ), oWnd:nHeight(), 0 ), 0 ),;
::nLeft - If( ! oWnd:IsKindOf( "TRBGROUP" ), oWnd:nLeft, 0 ), oWnd, .F. )
oWnd:oPopup = nil
::Refresh()
else
::click()
endif
Do you like to tinker with the code of TRBtn.Prg?
METHOD LButtonUp( nRow, nCol ) CLASS TRBtn
local oWnd
local lClick := IsOverWnd( ::hWnd, nRow, nCol )
local lAction := !empty( ::bAction )
if ::lDrag .or. ! Empty( ::oDragCursor )
return Super:LButtonUp( nRow, nCol )
endif
if ::bLButtonUp != nil
Eval( ::bLButtonUp, nRow, nCol)
endif
::lBtnUp = .t.
if ! ::lWorking
if ::lCaptured
::lCaptured = .f.
ReleaseCapture()
if ! ::lPressed
if ::lBtnDown
::lPressed = .t.
::Refresh()
endif
else
if ! ::lBtnDown
::lPressed = .f.
::Refresh()
endif
endif
if lClick
if ::oPopup != nil
do case
case ::nTypeButton == TYPE_SPLITPOPUP
if nRow >= ::nPopupMargin .or. ! lAction
if ::bOnPopup != nil
Eval( ::bOnPopup, nRow, nCol, Self )
else
oWnd := ::oWnd
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nHeight, 0, Self, .F. )
oWnd:oPopup = nil
::Refresh()
endif
else
::click()
endif
case ::nTypeButton == TYPE_POPUP
if nCol >= ::nPopupMargin .or. !lAction
if ::bOnPopup != nil
Eval( ::bOnPopup, nRow, nCol, Self )
else
oWnd := ::oWnd
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nHeight, 0, Self, .F. )
oWnd:oPopup = nil
::Refresh()
endif
else
::click()
endif
otherwise
::Click()
endcase
else
do case
case ::nTypeButton == TYPE_SPLITPOPUP
if nRow >= ::nPopupMargin .or. !lAction
if ::bOnPopup != nil
Eval( ::bOnPopup, nRow, nCol, Self )
else
MsgInfo( "Non defined popup menu", "Class TRBtn" )
endif
else
::click()
endif
case ::nTypeButton == TYPE_POPUP
if nCol >= ::nPopupMargin .or. !lAction
if ::bOnPopup != nil
Eval( ::bOnPopup, nRow, nCol, Self )
else
MsgInfo( "Non defined popup menu", "Class TRBtn" )
endif
else
::Click()
endif
otherwise
::Click()
endcase
endif
endif
endif
endif
return 0
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 105 guests