Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby dutch » Wed May 03, 2023 10:46 am

Dear All,

I have problem with BTNBMP and SBUTTON. It cannot make TRANSPARENT BUTTON, if I paint image on background.

This screen I use ::ReadImage() and DrawImage() for background. SBUTTON or BTNBMP will not transparent.
Imagewindows 7 screenshot
This screen I use XIMAGE ON INIT (STYLE WS_POPUP) for background. SBUTTON or BTNBMP will not transparent.
Image

Thanks in advance for any idea.
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1540
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Wed May 03, 2023 11:13 am

Code for tests?

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

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby dutch » Wed May 03, 2023 4:21 pm

Dear Karinha,

This code use SBUTTON.LIB.
Code: Select all  Expand view
#include 'Fivewin.ch'
#include 'TSbutton.ch'
#include 'Image.ch'

Static oWnd, nWndWidth, nWndHeight, oFont40

*------------------------------*
Function Main
local oBtn[4]
local aImage1

nWndWidth   := GetSysMetrics(0)
nWndHeight  := GetSysMetrics(1)

DEFINE FONT oFont40 NAME 'Tahoma' SIZE 0, -40

DEFINE WINDOW oWnd TITLE 'Test Button on Image Background' ;
         STYLE nOr( WS_POPUP, WS_VISIBLE ) ;
     COLOR CLR_WHITE, CLR_HGRAY

    aImage1 := oWnd:ReadImage( '.\TESTSBTN.JPG' )

    @ 200, 400 SBUTTON oBtn[1] PROMPT 'Check-Out' OF oWnd ;
                    SIZE 460,460 PIXEL ;           
                    RESOURCE "CHECKIN" ;
                    FONT oFont40 ;
                    W97 ;
                    ROUNDRECT ;
                    TEXT ON_BOTTOM ; // COLORS CLR_BLACK, CLR_GRAY ;
                    COLORS CLR_WHITE ;
                    ACTION (MsgInfo('ok1'))

    @  200,1000 SBUTTON oBtn[2] PROMPT 'Check-In' OF oWnd ;
                    SIZE 460,460 PIXEL ;           
                    RESOURCE "CHECKOUT" ;
                    FONT oFont40 ;                     
                    LOOK W97 ;             
                    ROUNDRECT ;
                    TEXT ON_BOTTOM ;
                    COLORS CLR_WHITE ;
                    ACTION CheckIn()
                   
    @  700, 800 SBUTTON oBtn[2] PROMPT 'Exit' OF oWnd ;
                    SIZE 150,100 PIXEL ;           
                    FONT oFont40 ;                     
                    LOOK W97 ;             
                    ROUNDRECT ;
                    TEXT ON_BOTTOM ;
                    COLORS CLR_WHITE ;
                    ACTION oWnd:End()

ACTIVATE WINDOW oWnd MAXIMIZED ;
            ON PAINT oWnd:DrawImage( aImage1, {120, 0, nWndHeight-100, nWndWidth }, nil, .T., 40, nil )

RELEASE FONT oFont40

return nil

*-----------------*
Function CheckIn()
local oFnt, oDlg, oBtn[4], oSay, oBmp, oDlgCLose, oImg, aImage1, oBrush


            DEFINE DIALOG oDlg SIZE nWndWidth, nWndHeight ;
                     STYLE nOr( WS_CHILD, WS_POPUP ) ;
                   COLOR CLR_BLACK, CLR_WHITE ;  

                oDlg:lHelpIcon := .F.

                                 
            ACTIVATE DIALOG oDlg CENTER ON INIT  (ShowImg( oDlg, oBtn ))
           
                                 
return .T.

*-------------------------------------*
Function ShowImg( oDlg, oBtn )
local oImg
local cImage := '.\TESTSBTN.JPG'


    @  120, 0 XIMAGE oImg SOURCE cImage NOBORDER SIZE nWndWidth, nWndHeight-220 OF oDlg UPDATE
                 
                  oImg:FitWidth()
                  oImg:FitHeight()
                  oImg:lBmpTransparent := .T.

        @   200, 400 SBUTTON oBtn[1] PROMPT 'Walk-In'  OF oImg ;
                        SIZE 460, 460 PIXEL ;
                        RESOURCE "WALKIN" ;
                        FONT oFont40 ;
                        LOOK W97 ;
                        TEXT POSITION ON_BOTTOM ;
                        ACTION MsgInfo('ok')
                       
        @  200,1000 SBUTTON oBtn[2] PROMPT 'Booking' OF oImg ;
                        SIZE 460, 460 PIXEL ;
                        RESOURCE "BOOKING" ;
                        FONT oFont40 ;
                        LOOK W97 ;
                        TEXT POSITION ON_BOTTOM ;
                        ACTION MsgInfo('ok')
                               
        @  700, 800 SBUTTON oBtn[2] PROMPT 'Back' OF oImg ;
                        SIZE 150,150 PIXEL ;           
                        FONT oFont40 ;                     
                        LOOK W97 ;             
                        ROUNDRECT ;
                        TEXT ON_BOTTOM ;
                        COLORS CLR_BLACK ;
                        ACTION oDlg:End()

return .T.
 

RES file and JPG file in code.
https://drive.google.com/file/d/1xCIil_WLFy7yQJayr5rC55vX8xUyj9Qf/view?usp=share_link

karinha wrote:Code for tests?

regards.


Thanks for testing.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1540
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Wed May 03, 2023 5:00 pm

Google drive access request, sent.

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

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby nageswaragunupudi » Wed May 03, 2023 5:01 pm

Please send me two or three button images to my email.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Wed May 03, 2023 9:41 pm

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

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Wed May 03, 2023 9:45 pm

WOW2() hahahaha.

https://imgur.com/xvbOuJ6

Image

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

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Wed May 03, 2023 10:06 pm

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

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby dutch » Thu May 04, 2023 6:55 am

Dear Karinha,

The button is still not transparent.
karinha wrote:WOW()

https://imgur.com/3O8NTXM
Image



Regards.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1540
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Thu May 04, 2023 11:08 am

Hello Dutch. This is as much as I can get. More than that, my knowledge was exhausted. If not, talk to the FIVETECH team.

Hola Dutch. Esto es todo lo que puedo conseguir. Más que eso, mi conocimiento estaba agotado. Si no, habla con el equipo de FIVETECH.

https://imgur.com/miKWLIr

Image

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

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby Jimmy » Thu May 04, 2023 11:10 am

hi,

what about using (x)IMAGE or BITMAP and ON CLICK instead of Button :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Thu May 04, 2023 11:42 am

I LOVE FIVEWIN:

Code: Select all  Expand view

// C:\DUTCH\TESTSBTN.PRG - Modified by: kapiabafwh@gmail.com - 04/05/2023

#include 'Fivewin.ch'
#include 'Image.ch'

#Define CLR_GOLD1        RGB( 255, 215, 000 ) //-> Gold1  - Ouro 1
#Define CLR_GOLD2        RGB( 238, 201, 000 ) //-> Gold2  - Ouro 2
#Define CLR_GOLD3        RGB( 205, 173, 000 ) //-> Gold3  - Ouro 3
#Define CLR_GOLD4        RGB( 139, 117, 000 ) //-> Gold4  - Ouro 4
#define CLR_PretoDark    RGB(   0,   0,   0 )
#define CLR_SombrioDark  RGB(  29,  29,  29 )
#define CLR_CinzaDarkp   RGB(  34,  34,  34 )
#define CLR_Cinza_Dark   RGB(  51,  51,  51 )
#define CLR_CinzentoDark RGB(  85,  85,  85 )
#define CLR_CinzaWhite   RGB( 153, 153, 153 )
#define DLGCOLOR1        RGB( 240, 249, 255 )
#define DLGCOLOR2        RGB( 250, 250, 245 )
#define DLGCOLOR3        RGB( 245, 245, 235 )
#define DLGCOLOR4        RGB( 255, 255, 250 )

STATIC oWnd, nWndWidth, nWndHeight, oFont40

FUNCTION Main()

   LOCAL oCursorBtn := TCursor():New(, 'HAND' )
   LOCAL aImage1, oBtn:= ARRAY(12), oFont

   SkinButtons()

   nWndWidth  := GetSysMetrics( 0 )
   nWndHeight := GetSysMetrics( 1 )

   DEFINE FONT oFont NAME "Segoe UI Light" SIZE 0,-18 BOLD
   DEFINE FONT oFont40 NAME 'Tahoma' SIZE 0, -40 // BOLD

   // RESOLUTION: 1024 X 768
   DEFINE WINDOW oWnd TITLE 'Test Button on Image Background'                  ;
      STYLE nOr( WS_POPUP, WS_VISIBLE ) COLOR CLR_HGRAY, CLR_WHITE

   oWnd:SetFont( oFont )
   oWnd:nOpacity := 240

   aImage1 := oWnd:ReadImage( '.\TESTSBTN.JPG' )

   // 200, 400 ONLY TEST IN MY COMPUTER - ROUNDRECT
   @ 100, 0015 BTNBMP  oBtn[01] PROMPT "Check-Out" OF oWnd SIZE 460, 460 PIXEL ;
      RESOURCE "CHECKIN" FONT oFont40 NOBORDER TEXT ON_BOTTOM COLOR CLR_GOLD2  ;
      FLAT UPDATE 2007 ACTION ( MsgInfo( 'ok1' ) )

   oBtn[01]:lTransparent := .T.

   // 200, 1000
   @ 100, 0550 BTNBMP  oBtn[02] PROMPT "Check-In" OF oWnd SIZE 460, 460 PIXEL  ;
      RESOURCE "CHECKOUT" FONT oFont40 NOBORDER TEXT ON_BOTTOM COLOR CLR_GOLD3 ;
      FLAT UPDATE 2007 ACTION CheckIn( oBtn )

   oBtn[02]:lTransparent := .T.

   // 700, 700 Great Resolution
   @ 570, 0462 BTNBMP oBtn[03] PROMPT "Exit" OF oWnd SIZE 100, 100 PIXEL       ;
      RESOURCE "EXIT" FONT oFont40 NOBORDER TEXT ON_BOTTOM COLOR CLR_GOLD4     ;
      FLAT UPDATE 2007 ACTION( oWnd:End() ) // TRANSPARENT // .OR. lTransparent

   oBtn[03]:lTransparent := .T.
   oBtn[03]:lCancel      := .T.
   oBtn[03]:lEllipse     := .T.

   FOR n = 1 TO 3

      oBtn[ n ]:bClrGrad = {| lInvert | If( ! lInvert, ;
         { { 0.25, DLGCOLOR3, DLGCOLOR2 }, ;
         { 0.75, DLGCOLOR3, DLGCOLOR1 } }, ;
         { { 0.25, DLGCOLOR2, DLGCOLOR1 }, ;
         { 0.75, DLGCOLOR1, DLGCOLOR2 } } ) }

      oBtn[ n ]:nClrBorder := nRgb( 238, 236, 219 )
      oBtn[ n ]:oCursor    := oCursorBtn

   NEXT

   ACTIVATE WINDOW oWnd MAXIMIZED ;
      ON PAINT oWnd:DrawImage( aImage1, { 120, 0, nWndHeight - 100, nWndWidth }, NIL, .T., 40, NIL )

   oFont:End()
   oFont40:End()

RETURN NIL

FUNCTION CheckIn( oBtn )

   LOCAL oFnt, oDlg, oSay, oBmp, oDlgCLose, oImg, aImage1, oBrush

   DEFINE DIALOG oDlg SIZE nWndWidth, nWndHeight STYLE nOr( WS_CHILD, WS_POPUP ) ;
      COLORS CLR_SombrioDark, CLR_WHITE TRANSPARENT

   oDlg:lHelpIcon := .F.

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( ShowImg( oDlg, oBtn ) )

RETURN( .T. )

FUNCTION ShowImg( oDlg, oBtn )

   LOCAL oCursorBtn := TCursor():New(, 'HAND' )
   LOCAL oImg
   LOCAL cImage := '.\TESTSBTN.JPG'

   @  120, 0 XIMAGE oImg SOURCE cImage SIZE nWndWidth, nWndHeight - 220      ;
      OF oDlg NOBORDER UPDATE ADJUST

   oImg:FitWidth()
   oImg:FitHeight()

   oImg:lBmpTransparent := .T.
   oImg:nUserControl := 0

   // 200,400
   @ 090, 0015 BTNBMP oBtn[04] PROMPT "Walk-In" OF oImg SIZE 460, 460 PIXEL  ;
      RESOURCE "WALKIN" FONT oFont40 NOROUND TEXT ON_BOTTOM COLOR CLR_GOLD2  ;
      FLAT UPDATE ACTION MsgInfo( "Walk-In" )

   oBtn[04]:lTransparent := .T.

   @ 090, 0550 BTNBMP oBtn[05] PROMPT "Booking" OF oImg SIZE 460, 460 PIXEL  ;
      RESOURCE "BOOKING" FONT oFont40 NOROUND TEXT ON_BOTTOM COLOR CLR_GOLD3 ;
      FLAT UPDATE ACTION MsgInfo( "Walk-In" )

   oBtn[05]:lTransparent := .T.

   @ 000, 0462 BTNBMP oBtn[06] PROMPT "Back" OF oImg SIZE 100, 088 PIXEL     ;
      RESOURCE "EXIT" FONT oFont40 ROUNDRECT  TEXT ON_BOTTOM COLOR CLR_GOLD4 ;
      FLAT UPDATE 2007 ACTION( oDlg:End() )

   oBtn[06]:lTransparent := .T.
   oBtn[06]:lCancel      := .T.
   oBtn[06]:lEllipse     := .T.

   FOR n = 4 TO 6

      oBtn[ n ]:bClrGrad = {| lInvert | If( ! lInvert, ;
         { { 0.25, DLGCOLOR3, DLGCOLOR2 }, ;
         { 0.75, DLGCOLOR3, DLGCOLOR1 } }, ;
         { { 0.25, DLGCOLOR2, DLGCOLOR1 }, ;
         { 0.75, DLGCOLOR1, DLGCOLOR2 } } ) }

      oBtn[ n ]:nClrBorder := nRgb( 238, 236, 219 )
      oBtn[ n ]:oCursor :=   oCursorBtn

   NEXT

RETURN( .T. )

// FIN / END - kapiabafwh@gmail.com - João Santos - São Paulo - Brazil.
 


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

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Thu May 04, 2023 11:49 am

Hi Dutch,

Download complete, version 2.

https://mega.nz/file/sJczySiD#Og7g5FMoNZ-CqFFj-AxvKlWW-c1GrCeiEIYPC5qv3UA

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

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby dutch » Fri May 05, 2023 3:46 am

Dear Jimmy,

Thanks for an idea.
Jimmy wrote:hi,

what about using (x)IMAGE or BITMAP and ON CLICK instead of Button :?:
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1540
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Problem with TRANSPARENT BTNBMP or SBUTTON on WINDOW/DIALOG

Postby karinha » Sat May 06, 2023 12:42 pm

Very good! Another model in case anyone needs it.

¡Muy bien! Otro modelo por si alguien lo necesita.

Download Complete:

https://mega.nz/file/EUcDSaiC#1aDPNv2z6_yD5wfbjme0fRLbhtqo5_0fIjZi-lZ5-do

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests