error in btnbmp

error in btnbmp

Postby Silvio » Wed Mar 19, 2008 6:53 pm

if i make this test :
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg , omenutry

   SET _3DLOOK ON

   MENU omenutry POPUP  2007

      MENUITEM "first menu"
      MENUITEM "second menu"
      ENDMENU

   DEFINE DIALOG oDlg RESOURCE "Main" COLOR "N/B"

   REDEFINE BTNBMP ID 110 OF oDlg ;
      RESOURCE "Yes" NOBORDER ACTION oDlg:End()
     
    oDlg:aControls[ 1 ]:lTransparent = .t.

   REDEFINE BTNBMP ID 120 OF oDlg ;
      RESOURCE "No"
      oDlg:aControls[ 2 ]:oPopup := omenutry

   REDEFINE BTNBMP ID 130 OF oDlg ;
      RESOURCE "Cancel"

   ACTIVATE DIALOG oDlg CENTERED

return nil


THE RESOURCES FILE IS TESTBTNB.RC ( ON SAMPLES FOLDER OF FWH)

it make error on the secondo button when I click to open the menu popup

NCMOUSEMOVE

at TBTNBMP:LBUTTONUP(0)

How I can resolve it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Wed Mar 19, 2008 8:29 pm

Silvio,

Please modify Class TBtnBmp Method LButtonUp() this way:
Code: Select all  Expand view  RUN
METHOD LButtonUp( nRow, nCol )  CLASS TBtnBmp

   local oWnd
   local lClick := IsOverWnd( ::hWnd, nRow, nCol )

   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
               if nCol >= ::nWidth() - 13
                  if ::oWnd:oWnd != nil .and. Upper( ::oWnd:oWnd:Classname() ) == "TBAR"
                     oWnd := ::oWnd:oWnd
                  else
                     oWnd := ::oWnd
                  endif
                  oWnd:NcMouseMove() // close the tooltip
                  oWnd:oPopup = ::oPopup
                  ::oPopup:Activate( ::nTop + ::nHeight(), ::nLeft, oWnd, .f. )
                  oWnd:oPopup = nil
                  ::Refresh()
               else
                  ::Click()
               endif
            else
               ::Click()
            endif
         endif
      endif
   endif

return 0

Now your sample works fine :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Wed Mar 19, 2008 11:18 pm

Silvio,

We have also improved PALBTNPAINT() so the bitmap looks in the proper position when the popup menu is used:
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], wilsongamboa and 86 guests