Ribbon Button's popup menu

Ribbon Button's popup menu

Postby fraxzi » Sat May 01, 2010 7:51 am

Dear All,

Image

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
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Ribbon Button's popup menu

Postby Enrico Maria Giordano » Sat May 01, 2010 10:20 am

If I understood correctly, you can use the ACTION clause.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Ribbon Button's popup menu

Postby nageswaragunupudi » Sat May 01, 2010 11:33 am

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?
Regards

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

Re: Ribbon Button's popup menu

Postby fraxzi » Sat May 01, 2010 2:22 pm

Enrico Maria Giordano wrote:If I understood correctly, you can use the ACTION clause.

EMG



Dear EMG,

ACTION Clause if you pressed the button but the TYPE_SPLITPOPUP (the portion with popup menu) that I need to determine or alter the behavior say
instead of poping the popupmenu, maybe like invoking xBrowse( 'table' ) or an xbrowse list of records.. and still retain the ACTION clause default behavior.


Regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Ribbon Button's popup menu

Postby fraxzi » Sat May 01, 2010 2:30 pm

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?


Dear RAO,

I tried oRbtn:bLButtonUp := {|nRow, nCol| xBrowse( 'table' ) } .. this is executed if I pressed the button or the popupmenu portion.. if I can only assign and execute the popupmenu portion.. and still retain the ACTION clause's default behavior..

This 'can be' similar to oPopup:bWhen maybe or a codeblock somewhere before oPopup:Activate()?


Regards,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: Ribbon Button's popup menu

Postby nageswaragunupudi » Sat May 01, 2010 2:36 pm

Mr Fraxzi

Its not impossible. And I prefer to do it without altering library code. I shall try when I get some free time. Meanwhile you can also try. You know where to start anyway
Regards

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

Re: Ribbon Button's popup menu

Postby Daniel Garcia-Gil » Sat May 01, 2010 2:39 pm

Mr Fraxzi


is neccesary modify TRBTN Class

isn't difficult

add new data

DATA bOnPopup

Change METHOD LButtonUp( nRow, nCol ) CLASS TRBtn
Code: Select all  Expand view

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
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita


Return to FiveWin for Harbour/xHarbour

Who is online

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