BtnBmp and oPopup

BtnBmp and oPopup

Postby Otto » Fri Jun 02, 2023 7:57 am

Image

Hello friends,

I have expanded the TBtnBmp.
Now, when I insert a PopupMenu, I can select the width of the clickable area and use a bitmap instead of the PolyPolygon.
Best regards,
Otto


Code: Select all  Expand view

METHOD PaintPopupSection() CLASS TBtnBmp

   local nWidth, nHeight, hDC
   local hBlackBrush, hOldBrush
   local hDarkPen, hLightPen, hOldPen
   
   
   if ::oPopup != nil
      nHeight = ::nHeight
      nWidth  = ::nWidth
      hDC     = ::hDC
     
     
      hBlackBrush = GetStockObject( 4 )  //4
      hOldBrush   = SelectObject( hDC, hBlackBrush )
   
      FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\ichat.bmp", {::nHeight-30, ::nWidth-25, ::nHeight - 10, ::nWidth-5}, .t. )
   
     
     /*
      PolyPolygon( hDC, { { nWidth - ::nWPop + If( ::lPressed, 1, 0 ),;
         nHeight / 2 - 1 + If( ::lPressed, 1, 0 ) },;
         { nWidth - 7 + If( ::lPressed, 1, 0 ), nHeight / 2 + 1 + ;
           If( ::lPressed, 1, 0 ) },;
         { nWidth - 5 + If( ::lPressed, 1, 0 ), nHeight / 2 - 1 + ;
           If( ::lPressed, 1, 0 ) },;
         { nWidth - ::nWPop + If( ::lPressed, 1, 0 ), nHeight / 2 - 1 + ;
           If( ::lPressed, 1, 0 ) } } )
*/




      if ::lBorder .or. ::lPressed .or. ::lMOver
         hDarkPen  = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) )
         hLightPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) )
         hOldPen = SelectObject( hDC, hLightPen )
         MoveTo( hDC, nWidth - ( ::nWPop + 3 ) + If( ::lPressed, 1, 0 ), 1 )
         LineTo( hDC, nWidth - ( ::nWPop + 3 ) + If( ::lPressed, 1, 0 ), nHeight - 1 )
         SelectObject( hDC, hDarkPen )
         MoveTo( hDC, nWidth - ( ::nWPop + 4 ) + If( ::lPressed, 1, 0 ), 1 )
         LineTo( hDC, nWidth - ( ::nWPop + 4 ) + If( ::lPressed, 1, 0 ), nHeight - 1 )
         SelectObject( hDC, hOldPen )
         DeleteObject( hDarkPen )
         DeleteObject( hLightPen )
      endif

      SelectObject( hDC, hOldBrush )
      DeleteObject( hBlackBrush )
     
   endif

return nil

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


 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: BtnBmp and oPopup

Postby Antonio Linares » Fri Jun 02, 2023 10:12 am

Dear Otto,

thank you for sharing it :-)
regards, saludos

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

Re: BtnBmp and oPopup

Postby Silvio.Falconi » Wed Jun 07, 2023 8:36 am

>FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\ichat.bmp", {::nHeight-30, ::nWidth-25, ::nHeight - 10, ::nWidth-5}, .t. )

for me it's no good

perhaps...

Code: Select all  Expand view
data hBmpPop


on METHOD Paint() CLASS TBtnBmp

Code: Select all  Expand view
if ::oPopup != nil
 if ::hBmpPop != 0
        DrawBitmap( ::hDC, ::hBmpPop, aRect[1]+5, aRect[4]-15 )
            else
   ::PaintPopupSection()
endif
endif



instead of

Code: Select all  Expand view
if ::oPopup != nil
      ::PaintPopupSection()
   endif



but before we must load ::hBmpPop on New method

Code: Select all  Expand view
::hBmpPop      := ::LoadBmp( cBtnPop )



See on my class TBtnClr how I made
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: BtnBmp and oPopup

Postby karinha » Wed Jun 07, 2023 12:18 pm

I agree with Silvio, it wasn't good.

Estoy de acuerdo con Silvio, no fue bueno.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: BtnBmp and oPopup

Postby Otto » Wed Jun 07, 2023 12:25 pm

Hello,
That was just a suggestion.
Here we need new data variables.

Then everyone can load the ICON they want.

Again, it should only serve as a suggestion to extend the class.

It's like comparing apples and oranges to modify a class for personal use or to make it universally applicable. I can only do the former.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests