BtnBmp and oPopup

Post Reply
User avatar
Otto
Posts: 6416
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 35 times
Been thanked: 2 times
Contact:

BtnBmp and oPopup

Post by Otto »

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

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
Antonio Linares
Site Admin
Posts: 42655
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 67 times
Been thanked: 96 times
Contact:

Re: BtnBmp and oPopup

Post by Antonio Linares »

Dear Otto,

thank you for sharing it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio.Falconi
Posts: 7187
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 9 times

Re: BtnBmp and oPopup

Post by Silvio.Falconi »

>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

data hBmpPop
on METHOD Paint() CLASS TBtnBmp

Code: Select all | Expand

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

 if ::oPopup != nil
      ::PaintPopupSection()
   endif

but before we must load ::hBmpPop on New method

Code: Select all | Expand

::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 March-April 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
karinha
Posts: 7963
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 5 times
Contact:

Re: BtnBmp and oPopup

Post by karinha »

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
Otto
Posts: 6416
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 35 times
Been thanked: 2 times
Contact:

Re: BtnBmp and oPopup

Post by Otto »

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
********************************************************************
Post Reply