Right click in empty xBrowse

Right click in empty xBrowse

Postby PeterHarmes » Fri Oct 07, 2011 8:30 am

Hi,

A while back there was a change put in to xBrowse to allow you to right click and if defined a popup menu would appear if the xbrowse was empty or the mouse was in an empty area of the xbrowse (around version 10.06/10.07)

This seems to have disapeared since then - is there any chance that this could be put back in (or help me put it into the latest version (11.09)?

I use this a lot for adding records to a list and if there isnt any records to show, you cannot right click to add.

Best Regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Right click in empty xBrowse

Postby PeterHarmes » Fri Oct 07, 2011 8:48 am

I'm not sure if this is the correct fix, but could someone check my modification? nageswaragunupudi?

Code: Select all  Expand view


METHOD RButtonDown( nRow, nCol, nKeyFlags ) CLASS TXBrowse

   local oCol
   local nColPos, nRowPos
   local bPopUp

   ::CancelEdit()
   ::Seek()

   nRowPos := ::MouseRowPos( nRow )
   nColPos := ::MouseColPos( nCol )

   if nColPos <= 0
      if nRow >= ::FirstRow()
         Super:RButtonDown( nRow, nCol, nKeyFlags )
         return nil
      else
         if ::lAllowColHiding
            ::SetColumns( nRow, nCol, nKeyFlags )
         endif
         return nil
      endif
   endif

   oCol     := ::ColAtPos( nColPos )
   bPopUp   := ifnil( oCol:bPopUp, ::bPopUp )

   if ::MouseAtHeader( nRow, nCol )
      if oCol:bRClickHeader != nil
         return Eval( oCol:bRClickHeader, nRow, nCol, nKeyFlags, oCol )
      elseif ::lAllowColHiding
         return ::SetColumns( nRow, nCol, nKeyFlags )
      endif
   elseif ::MouseAtFooter( nRow, nCol )
      if oCol:bRClickFooter != nil
         return Eval( oCol:bRClickFooter, nRow, nCol, nKeyFlags, oCol )
      endif
   elseif nRowPos > 0
      if nRowPos != ::nRowSel
         if ! ::FullPaint()
            ::DrawLine()
         endif
         ::Skip( nRowPos - ::nRowSel )
         ::nRowSel := nRowPos
         if nColPos > 0
            ::nColSel   := nColPos
         endif
         ::Change( .t. )
      elseif nColPos > 0 .and. ::nColSel != nColPos
         ::nColSel := nColPos
         ::Change( .f. )
      endif
      if Len( ::aSelected ) > 0 .and. AScan( ::aSelected, ::BookMark ) == 0
         ::Select( 0 )
         ::Select( 1 )
      endif
      if ::FullPaint()
         ::Super:Refresh( .t. )
      else
         ::DrawLine( .t. )
      endif
      if ::oVScroll != nil
         ::VSetPos( ::KeyNo() )
      endif
      if ::oHScroll != nil
         ::oHScroll:SetPos( ::nColSel )
      endif
      if bPopUp != nil
         Eval( bPopUp, oCol ):Activate( (::nRowSel * ::nRowHeight) + ::nHeaderHeight, oCol:nDisplayCol, Self )
         return 0
      elseif oCol:bRClickData != nil
         return Eval( oCol:bRClickData, nRow, nCol, nKeyFlags, oCol )
      endif
   else
      if bPopUp != nil
         Eval( bPopUp, oCol ):Activate( (::nRowSel * ::nRowHeight) + ::nHeaderHeight, oCol:nDisplayCol, Self )
         return 0
      elseif oCol:bRClickData != nil
         return Eval( oCol:bRClickData, nRow, nCol, nKeyFlags, oCol )
      endif    
   endif

   If nColPos != 0 .and. nRowPos != 0
      return Super:RButtonDown( nRow, nCol, nKeyFlags )
   endif

return 0

 
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England


Return to FiveWin for Harbour/xHarbour

Who is online

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