Another for Btnbmp

Another for Btnbmp

Postby Silvio.Falconi » Tue Mar 19, 2024 11:59 am

I have two btnbmp

Image

when I press a button then a black border forms how do I remove the black border?

the test

Code: Select all  Expand view  RUN
Function test()
   local oDlg,oFont,oBold
   local oCursorBtn :=TCursor():New(,'HAND')
local oBtn:=array(2)
local nWd  := GetSysMetrics(0) * .58
local nHt  := (GetSysMetrics(1) / 2 ) -20


oFont := TFont():New( "TAHOMA", 0, 14,, )
  oBold := TFont():New( "TAHOMA", 0, 14,,.t. )
   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL ;
       FONT oFont   COLOR CLR_BLACK, RGB( 245,245,235)  ;
       STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
                  WS_MINIMIZEBOX)  

@ 10, 30  BTNBMP obtn[1] ;
       PROMPT "text" LEFT ;
      FILENAME "1.bmp"   ;
      SIZE 45, 13 PIXEL FLAT NOROUND GDIP   OF oDlg ;
      ACTION NIL

@ 30, 30  BTNBMP obtn[2] ;
       PROMPT "text" LEFT ;
      FILENAME "2.bmp"   ;
      SIZE 45, 13 PIXEL FLAT NOROUND GDIP   OF oDlg ;
      ACTION NIL

For n= 1 to len(oBtn)

            obtn[n]:bClrGrad := { | lPressed | If( ! lPressed,;
                 { { 1, RGB( 250,250,245), RGB( 250,250,245)} },;
                 { { 1,  RGB( 245,245,235),  RGB( 245,245,235)} } ) }
                  obtn[n]:nClrBorder := RGB(195,195,185)
              obtn[n]:oCursor:=   oCursorBtn
           next



Activate DIALOG oDlg
return nil


the black border would be the focus but it's ugly to see how do I remove it or how can I change its color?
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby karinha » Tue Mar 19, 2024 1:17 pm

Mira si ayuda:

Code: Select all  Expand view  RUN

// C:\FWH/SAMPLES\SILVBTN3.PRG

#include "FiveWin.ch"

/*
#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }
*/


FUNCTION Main()

   LOCAL oDlg, oFont, oBold, oBmp
   LOCAL oCursorBtn := TCursor():New(, 'HAND' )
   LOCAL oBtn := Array( 2 )
   LOCAL nWd  := GetSysMetrics( 0 ) * .58
   LOCAL nHt  := ( GetSysMetrics( 1 ) / 2 ) - 20

   SkinButtons()

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
   DEFINE FONT oBold NAME 'Tahoma' SIZE 0, -16 BOLD

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL FONT oFont TRANSPARENT  ;
      STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
      WS_MINIMIZEBOX ) COLOR CLR_BLACK, RGB( 245, 245, 235 )

   @ 10, 30  BTNBMP oBtn[1] PROMPT "Add" LEFT 2007 FONT oBold ;
      FILENAME "..\bitmaps\16x16\floppy.bmp"                  ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg    ;
      COLOR CLR_WHITE, CLR_BLACK ACTION NIL

   // oBtn[1]:bClrGrad := aPubGrad   // 1 ejemplo mi gusto personal.

   oBtn[1]:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }

   WITH OBJECT oBtn[1]

      :nClrBorder := RGB( 195, 195, 185 )

   END

   oBtn[1]:oCursor := oCursorBtn

   @ 30, 30  BTNBMP oBtn[2] PROMPT "Exit" LEFT 2007 FONT oBold  ;
      FILENAME "..\bitmaps\16x16\Exit.bmp"                      ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg      ;
      ACTION( oDlg:End() ) COLOR CLR_HRED, CLR_BLACK

   // oBtn[2]:bClrGrad := aPubGrad   // 1 ejemplo a gusto.

   oBtn[2]:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }

   WITH OBJECT oBtn[2]

      :nClrBorder := RGB( 195, 195, 185 )

   END

   oBtn[2]:oCursor:= oCursorBtn
   oBtn[2]:lCancel := .T.

   DEFINE BITMAP oBmp FILENAME "..\bitmaps\visual.bmp"

   oDlg:bPainted = { | hDC | BmpTiled( hDC, oDlg, oBmp ) }

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End()
   oBold:End()

RETURN NIL

STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )

   local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
   local nRow := 0, nCol := 0, n
   local nBmpWidth  := oBmp:nWidth(),  nBmpHeight := oBmp:nHeight()

   if oBmp:hBitmap == 0
      return nil
   endif

   while nRow < nHeight
      nCol = 0
      while nCol < nWidth
         PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
         nCol += nBmpWidth
      end
      nRow += nBmpHeight
   end

return nil

// FIN / END - kapiabafwh@gmail.com
 


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

Re: Another for Btnbmp

Postby Silvio.Falconi » Tue Mar 19, 2024 11:17 pm

karinha wrote:Mira si ayuda:

Code: Select all  Expand view  RUN

// C:\FWH/SAMPLES\SILVBTN3.PRG

#include "FiveWin.ch"

/*
#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }
*/


FUNCTION Main()

   LOCAL oDlg, oFont, oBold, oBmp
   LOCAL oCursorBtn := TCursor():New(, 'HAND' )
   LOCAL oBtn := Array( 2 )
   LOCAL nWd  := GetSysMetrics( 0 ) * .58
   LOCAL nHt  := ( GetSysMetrics( 1 ) / 2 ) - 20

   SkinButtons()

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14
   DEFINE FONT oBold NAME 'Tahoma' SIZE 0, -16 BOLD

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL FONT oFont TRANSPARENT  ;
      STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
      WS_MINIMIZEBOX ) COLOR CLR_BLACK, RGB( 245, 245, 235 )

   @ 10, 30  BTNBMP oBtn[1] PROMPT "Add" LEFT 2007 FONT oBold ;
      FILENAME "..\bitmaps\16x16\floppy.bmp"                  ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg    ;
      COLOR CLR_WHITE, CLR_BLACK ACTION NIL

   // oBtn[1]:bClrGrad := aPubGrad   // 1 ejemplo mi gusto personal.

   oBtn[1]:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }

   WITH OBJECT oBtn[1]

      :nClrBorder := RGB( 195, 195, 185 )

   END

   oBtn[1]:oCursor := oCursorBtn

   @ 30, 30  BTNBMP oBtn[2] PROMPT "Exit" LEFT 2007 FONT oBold  ;
      FILENAME "..\bitmaps\16x16\Exit.bmp"                      ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg      ;
      ACTION( oDlg:End() ) COLOR CLR_HRED, CLR_BLACK

   // oBtn[2]:bClrGrad := aPubGrad   // 1 ejemplo a gusto.

   oBtn[2]:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }

   WITH OBJECT oBtn[2]

      :nClrBorder := RGB( 195, 195, 185 )

   END

   oBtn[2]:oCursor:= oCursorBtn
   oBtn[2]:lCancel := .T.

   DEFINE BITMAP oBmp FILENAME "..\bitmaps\visual.bmp"

   oDlg:bPainted = { | hDC | BmpTiled( hDC, oDlg, oBmp ) }

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End()
   oBold:End()

RETURN NIL

STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )

   local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
   local nRow := 0, nCol := 0, n
   local nBmpWidth  := oBmp:nWidth(),  nBmpHeight := oBmp:nHeight()

   if oBmp:hBitmap == 0
      return nil
   endif

   while nRow < nHeight
      nCol = 0
      while nCol < nWidth
         PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
         nCol += nBmpWidth
      end
      nRow += nBmpHeight
   end

return nil

// FIN / END - kapiabafwh@gmail.com
 


Regards, saludos.


I don't understand... do you think that changing the colors doesn't do the same thing?
I don't understand... I want the same colors that I put in and they must have the border with the color that I put in, why do I have to change the aesthetics of my entire application?
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby Antonio Linares » Wed Mar 20, 2024 8:58 am

Silvio,

Have you tried to remove this line ?

obtn[n]:nClrBorder := RGB(195,195,185)
regards, saludos

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

Re: Another for Btnbmp

Postby Silvio.Falconi » Wed Mar 20, 2024 11:13 am

Antonio Linares wrote:Silvio,

Have you tried to remove this line ?

obtn[n]:nClrBorder := RGB(195,195,185)


I remeber it wanted a codeblock with lMover but I 'm searching on forum now
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby Silvio.Falconi » Wed Mar 20, 2024 11:37 am

I wish only delete that internal Black Box

Image

I tried also with

For n= 1 to len(oBtn)

obtn[n]:bClrGrad := < |u,oBtn|
local clr := RGB( 245,245,235)
if oBtn:lActive
if oBtn:lMOver
clr := {{ 1, RGB( 250,250,245),RGB( 250,250,245) }}

elseif oBtn:lPressed
clr := RGB( 180,136,85 )

else
clr := RGB( 245,245,235)
endif
endif
return clr
>

obtn[n]:nClrBorder := RGB(195,195,185)
obtn[n]:oCursor:= oCursorBtn
next

Is it possible that it can't be removed or changed to another color?
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby karinha » Wed Mar 20, 2024 2:31 pm

Silvio, tell me where I'm going wrong now, please.

Silvio, dime ahora en qué me equivoco, por favor.

Code: Select all  Expand view  RUN

// C:\FWH/SAMPLES\SILVBTN3.PRG

#include "FiveWin.ch"

/*
#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }
*/


FUNCTION Main()

   LOCAL oDlg, oFont, oBold, oBmp, cTitle
   LOCAL oCursorBtn := TCursor():New(, 'HAND' )
   LOCAL oBtn := Array( 5 )
   LOCAL nWd  := GetSysMetrics( 0 ) * .58
   LOCAL nHt  := ( GetSysMetrics( 1 ) / 2 ) - 20

   SkinButtons()

   cTitle := "Test: BTNBMP Evolution"

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, - 14
   DEFINE FONT oBold NAME 'Tahoma' SIZE 0, - 16 BOLD

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL FONT oFont TRANSPARENT  ;
      STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
      WS_MINIMIZEBOX ) COLOR CLR_BLACK, RGB( 245, 245, 235 )      ;
      TITLE cTitle

   @ 10, 30  BTNBMP oBtn[ 1 ] PROMPT "&Add" LEFT 2007 FONT oBold  ;
      FILENAME "..\bitmaps\16x16\floppy.bmp"                      ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg        ;
      COLOR CLR_BLACK, CLR_WHITE ACTION NIL

   // oBtn[1]:bClrGrad := aPubGrad   // 1 ejemplo mi gusto personal.
   // oBtn[1]:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }

   oBtn[ 1 ]:bClrGrad := {| lPressed | If( ! lPressed,       ;
      { { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
      { { 1,  RGB( 245, 245, 235 ),  RGB( 245, 245, 235 ) } } ) }

   /*
   WITH OBJECT oBtn[1]

      :nClrBorder := RGB( 195, 195, 185 )

   END
   */


   oBtn[ 1 ]:oCursor := oCursorBtn
   oBtn[ 1 ]:lTransparent := .T.

   @ 30, 30  BTNBMP oBtn[ 2 ] PROMPT "&Exit" LEFT 2007 FONT oBold ;
      FILENAME "..\bitmaps\16x16\Exit.bmp"                      ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg      ;
      ACTION( oDlg:End() ) COLOR CLR_BLACK, CLR_WHITE

   // oBtn[2]:bClrGrad := aPubGrad   // 1 ejemplo a gusto.
   // oBtn[2]:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }

   oBtn[ 2 ]:bClrGrad := {| lPressed | If( ! lPressed,       ;
      { { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
      { { 1,  RGB( 245, 245, 235 ),  RGB( 245, 245, 235 ) } } ) }

   /*
   WITH OBJECT oBtn[2]

      :nClrBorder := RGB( 195, 195, 185 )

   END
   */


   oBtn[ 2 ]:oCursor := oCursorBtn
   oBtn[ 2 ]:lTransparent := .T.
   oBtn[ 2 ]:lCancel := .T.

   @ 50, 30  BTNBMP oBtn[ 3 ] PROMPT "&Print" LEFT 2007 FONT oBold ;
      FILENAME "..\bitmaps\16x16\printer.bmp"                      ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg         ;
      ACTION( oDlg:End() ) COLOR CLR_BLACK, CLR_WHITE

   // oBtn[3]:bClrGrad := aPubGrad   // 1 ejemplo a gusto.
   // oBtn[3]:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }
   // oBtn[3]:bClrGrad := { |lInvert| If( lInvert, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) ) }

   oBtn[ 3 ]:bClrGrad := {| lPressed | If( ! lPressed,       ;
      { { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
      { { 1,  RGB( 245, 245, 235 ),  RGB( 245, 245, 235 ) } } ) }

   /*
   WITH OBJECT oBtn[3]

      :nClrBorder := RGB( 195, 195, 185 )

   END
   */


   oBtn[ 3 ]:oCursor := oCursorBtn
   oBtn[ 3 ]:lTransparent := .T.
   oBtn[ 3 ]:lBoxSelect := .F.
   oBtn[ 3 ]:lEllipse = .T.

   DEFINE BITMAP oBmp FILENAME "..\bitmaps\visual.bmp"

   oDlg:bPainted = {| hDC | BmpTiled( hDC, oDlg, oBmp ) }

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End()
   oBold:End()

   RETURN NIL

STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )

   LOCAL nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
   LOCAL nRow := 0, nCol := 0, n
   LOCAL nBmpWidth  := oBmp:nWidth(),  nBmpHeight := oBmp:nHeight()

   IF oBmp:hBitmap == 0
      RETURN NIL
   ENDIF

   WHILE nRow < nHeight
      nCol = 0
      WHILE nCol < nWidth
         PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
         nCol += nBmpWidth
      END
      nRow += nBmpHeight
   END

   RETURN NIL

// FIN / END - kapiabafwh@gmail.com
 


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

Re: Another for Btnbmp

Postby Silvio.Falconi » Thu Mar 21, 2024 9:14 am

karinha wrote:Silvio, tell me where I'm going wrong now, please.

Silvio, dime ahora en qué me equivoco, por favor.

Code: Select all  Expand view  RUN

// C:\FWH/SAMPLES\SILVBTN3.PRG

#include "FiveWin.ch"

/*
#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }
*/


FUNCTION Main()

   LOCAL oDlg, oFont, oBold, oBmp, cTitle
   LOCAL oCursorBtn := TCursor():New(, 'HAND' )
   LOCAL oBtn := Array( 5 )
   LOCAL nWd  := GetSysMetrics( 0 ) * .58
   LOCAL nHt  := ( GetSysMetrics( 1 ) / 2 ) - 20

   SkinButtons()

   cTitle := "Test: BTNBMP Evolution"

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, - 14
   DEFINE FONT oBold NAME 'Tahoma' SIZE 0, - 16 BOLD

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL FONT oFont TRANSPARENT  ;
      STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
      WS_MINIMIZEBOX ) COLOR CLR_BLACK, RGB( 245, 245, 235 )      ;
      TITLE cTitle

   @ 10, 30  BTNBMP oBtn[ 1 ] PROMPT "&Add" LEFT 2007 FONT oBold  ;
      FILENAME "..\bitmaps\16x16\floppy.bmp"                      ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg        ;
      COLOR CLR_BLACK, CLR_WHITE ACTION NIL

   // oBtn[1]:bClrGrad := aPubGrad   // 1 ejemplo mi gusto personal.
   // oBtn[1]:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }

   oBtn[ 1 ]:bClrGrad := {| lPressed | If( ! lPressed,       ;
      { { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
      { { 1,  RGB( 245, 245, 235 ),  RGB( 245, 245, 235 ) } } ) }

   /*
   WITH OBJECT oBtn[1]

      :nClrBorder := RGB( 195, 195, 185 )

   END
   */


   oBtn[ 1 ]:oCursor := oCursorBtn
   oBtn[ 1 ]:lTransparent := .T.

   @ 30, 30  BTNBMP oBtn[ 2 ] PROMPT "&Exit" LEFT 2007 FONT oBold ;
      FILENAME "..\bitmaps\16x16\Exit.bmp"                      ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg      ;
      ACTION( oDlg:End() ) COLOR CLR_BLACK, CLR_WHITE

   // oBtn[2]:bClrGrad := aPubGrad   // 1 ejemplo a gusto.
   // oBtn[2]:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }

   oBtn[ 2 ]:bClrGrad := {| lPressed | If( ! lPressed,       ;
      { { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
      { { 1,  RGB( 245, 245, 235 ),  RGB( 245, 245, 235 ) } } ) }

   /*
   WITH OBJECT oBtn[2]

      :nClrBorder := RGB( 195, 195, 185 )

   END
   */


   oBtn[ 2 ]:oCursor := oCursorBtn
   oBtn[ 2 ]:lTransparent := .T.
   oBtn[ 2 ]:lCancel := .T.

   @ 50, 30  BTNBMP oBtn[ 3 ] PROMPT "&Print" LEFT 2007 FONT oBold ;
      FILENAME "..\bitmaps\16x16\printer.bmp"                      ;
      SIZE 45, 14 PIXEL FLAT NOROUND NOBORDER GDIP OF oDlg         ;
      ACTION( oDlg:End() ) COLOR CLR_BLACK, CLR_WHITE

   // oBtn[3]:bClrGrad := aPubGrad   // 1 ejemplo a gusto.
   // oBtn[3]:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }
   // oBtn[3]:bClrGrad := { |lInvert| If( lInvert, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) ) }

   oBtn[ 3 ]:bClrGrad := {| lPressed | If( ! lPressed,       ;
      { { 1, RGB( 250, 250, 245 ), RGB( 250, 250, 245 ) } }, ;
      { { 1,  RGB( 245, 245, 235 ),  RGB( 245, 245, 235 ) } } ) }

   /*
   WITH OBJECT oBtn[3]

      :nClrBorder := RGB( 195, 195, 185 )

   END
   */


   oBtn[ 3 ]:oCursor := oCursorBtn
   oBtn[ 3 ]:lTransparent := .T.
   oBtn[ 3 ]:lBoxSelect := .F.
   oBtn[ 3 ]:lEllipse = .T.

   DEFINE BITMAP oBmp FILENAME "..\bitmaps\visual.bmp"

   oDlg:bPainted = {| hDC | BmpTiled( hDC, oDlg, oBmp ) }

   ACTIVATE DIALOG oDlg CENTERED

   oFont:End()
   oBold:End()

   RETURN NIL

STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )

   LOCAL nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
   LOCAL nRow := 0, nCol := 0, n
   LOCAL nBmpWidth  := oBmp:nWidth(),  nBmpHeight := oBmp:nHeight()

   IF oBmp:hBitmap == 0
      RETURN NIL
   ENDIF

   WHILE nRow < nHeight
      nCol = 0
      WHILE nCol < nWidth
         PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
         nCol += nBmpWidth
      END
      nRow += nBmpHeight
   END

   RETURN NIL

// FIN / END - kapiabafwh@gmail.com
 


Regards, saludos.



1. I wish btnbmp with border noround and the color of border must be RGB( 195, 195, 185 )
2. the color of dialog must be CLR_BLACK, RGB( 245,245,235) no with background image

Image

¿Ves que después de presionar se forma un borde interno negro?

Do you see that after pressing, a black internal border forms?

Please see my test sample
Code: Select all  Expand view  RUN
#include "fivewin.ch"


Function test()
   local oDlg,oFont,oBold
   local oCursorBtn :=TCursor():New(,'HAND')

    local oBtn:=array(2)
    local nWd  := GetSysMetrics(0) * .58
    local nHt  := (GetSysMetrics(1) / 2 ) -20


     oFont := TFont():New( "TAHOMA", 0, 14,, )
     oBold := TFont():New( "TAHOMA", 0, 14,,.t. )

   DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL ;
       FONT oFont   COLOR CLR_BLACK, RGB( 245,245,235)  ;
       STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
                  WS_MINIMIZEBOX)

@ 10, 30  BTNBMP obtn[1] ;
       PROMPT "text" LEFT ;
      FILENAME "1.bmp"   ;
      SIZE 45, 13 PIXEL FLAT NOROUND GDIP   OF oDlg ;
      ACTION NIL

@ 30, 30  BTNBMP obtn[2] ;
       PROMPT "text" LEFT ;
      FILENAME "2.bmp"   ;
      SIZE 45, 13 PIXEL FLAT NOROUND GDIP   OF oDlg ;
      ACTION NIL



For n= 1 to len(oBtn)

 obtn[n]:bClrGrad  := < |u,oBtn|
         local clr      := RGB( 245,245,235)
         if oBtn:lActive
            if oBtn:lMOver
               clr   := {{ 1, RGB( 250,250,245),RGB( 250,250,245) }}

            elseif oBtn:lPressed
               clr   := RGB( 180,136,85 )

            elseif obtn:lProcessing
               clr   := RGB( 245,245,235)
            endif
         endif
         return clr
         >

       obtn[n]:nClrBorder := RGB(195,195,185)
       obtn[n]:oCursor:=   oCursorBtn
   next



   Activate DIALOG oDlg
   RELEASE oFont,oBold
return ni


en mi clase Tbtnclr cuando presiono el botón no se forma ningún borde negro interno

Image

el procedimiento probablemente sea incorrecto al crear el borde, de lo contrario no se puede explicar

in my Tbtnclr class when I press the button no internal black border is formed
the procedure is probably wrong when creating the border otherwise it can't be explained
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby Silvio.Falconi » Fri Mar 22, 2024 8:24 am

If that black box is the focus of btnbmp how I can delete that focus?
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby karinha » Fri Mar 22, 2024 1:04 pm

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

Re: Another for Btnbmp

Postby Silvio.Falconi » Fri Mar 22, 2024 2:05 pm



Lo siento, ¿estás bromeando?
si te digo que alguien ha hecho los botones cn tbtnbmp y estos controles no tienen el movimiento de click aparentemente son planos y al presionarlos no se forma el rectángulo negro por dentro, al pasar sobre ellos solo cambian de color sin deformarse las dimensiones
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby karinha » Fri Mar 22, 2024 2:14 pm

I've never seen anything like this. It's best if you speak directly to the FiveTech team.

Nunca he visto nada como esto. Es mejor si habla directamente con el equipo de FiveTech.

Gracias, thanks.

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

Re: Another for Btnbmp

Postby Silvio.Falconi » Fri Mar 22, 2024 9:42 pm

karinha wrote:I've never seen anything like this. It's best if you speak directly to the FiveTech team.

Nunca he visto nada como esto. Es mejor si habla directamente con el equipo de FiveTech.

Gracias, thanks.

Regards, saludos.



Me temo que el control del que estoy hablando es una clase btnbmp antigua o es un control nuevo, es decir, si miras mi clase tbtnclr, si colocas dos controles tbtnclr en un diálogo, ese rectángulo negro desaparecerá. Se forma dentro del botón y luego surge naturalmente la pregunta: ¿cómo es posible que btnbmp haga esto? Es decir, si marcas buttobmp no lo hace entonces ¿dónde está el error?
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby Silvio.Falconi » Sat Mar 23, 2024 11:34 am

Antonio, Nages,

when there is focus in the tbtnbmp class a transparent dotted rectangle must be formed and not a black rectangle
Furthermore it is aesthetically ugly to look at

How can I eliminate the movement of the button?

when I move the mouse over a btnbmp control the button must change color without shrinking and without making the typical movement of the button and when the button is pressed it must only call the action
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: 7070
Joined: Thu Oct 18, 2012 7:17 pm

Re: Another for Btnbmp

Postby Otto » Sat Mar 23, 2024 1:04 pm

Silvio,
Please include the file C:\FWH\source\classes\btnbmp.prg in your test program and then examine what the METHOD GotFocus( hCtlLost ) CLASS TBtnBmp does. You can then change the DrawFocusRect and the color.
Best regards,
Otto

Code: Select all  Expand view  RUN
METHOD GotFocus( hCtlLost ) CLASS TBtnBmp
local nWidth, hPen, hDC, hOldBrush
local nAdj := 0

if lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), WS_TABSTOP )
if ( nWidth := ::nWidth() ) > NO_FOCUSWIDTH
if ::lFlatStyle
::Refresh()
else
if ::lEllipse
::DrawFocusEllipse( ::GetDC() )
::ReleaseDC()
else
/*
nAdj = If( ::l2007 .or. ::l2010 .or. ::l2013 .or. ::l2015, 2, 0 )
DrawFocusRect( ::GetDC(), 2, 2, ::nHeight() - 4 + nAdj, nWidth - 4 + nAdj )
*/
::FocusRect()
endif
endif
endif
endif

return ::Super:GotFocus()

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], MaxP and 52 guests