Page 1 of 2

Another for Btnbmp

PostPosted: Tue Mar 19, 2024 11:59 am
by Silvio.Falconi
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
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?

Re: Another for Btnbmp

PostPosted: Tue Mar 19, 2024 1:17 pm
by karinha
Mira si ayuda:

Code: Select all  Expand view

// 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.

Re: Another for Btnbmp

PostPosted: Tue Mar 19, 2024 11:17 pm
by Silvio.Falconi
karinha wrote:Mira si ayuda:

Code: Select all  Expand view

// 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?

Re: Another for Btnbmp

PostPosted: Wed Mar 20, 2024 8:58 am
by Antonio Linares
Silvio,

Have you tried to remove this line ?

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

Re: Another for Btnbmp

PostPosted: Wed Mar 20, 2024 11:13 am
by Silvio.Falconi
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

Re: Another for Btnbmp

PostPosted: Wed Mar 20, 2024 11:37 am
by Silvio.Falconi
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?

Re: Another for Btnbmp

PostPosted: Wed Mar 20, 2024 2:31 pm
by karinha
Silvio, tell me where I'm going wrong now, please.

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

Code: Select all  Expand view

// 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.

Re: Another for Btnbmp

PostPosted: Thu Mar 21, 2024 9:14 am
by Silvio.Falconi
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

// 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
#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

Re: Another for Btnbmp

PostPosted: Fri Mar 22, 2024 8:24 am
by Silvio.Falconi
If that black box is the focus of btnbmp how I can delete that focus?

Re: Another for Btnbmp

PostPosted: Fri Mar 22, 2024 1:04 pm
by karinha

Re: Another for Btnbmp

PostPosted: Fri Mar 22, 2024 2:05 pm
by Silvio.Falconi


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

Re: Another for Btnbmp

PostPosted: Fri Mar 22, 2024 2:14 pm
by karinha
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.

Re: Another for Btnbmp

PostPosted: Fri Mar 22, 2024 9:42 pm
by Silvio.Falconi
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?

Re: Another for Btnbmp

PostPosted: Sat Mar 23, 2024 11:34 am
by Silvio.Falconi
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

Re: Another for Btnbmp

PostPosted: Sat Mar 23, 2024 1:04 pm
by Otto
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
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()

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