BTNTRNS can use with WINDOW?

BTNTRNS can use with WINDOW?

Postby dutch » Fri May 05, 2023 7:35 am

Dear All,

I try BTNTRNS, it works fine for DIALOG but it doesn't "Translucent background" on WINDOW.

Can it use with WINDOW?

Thanks in advance,
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: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: BTNTRNS can use with WINDOW?

Postby Antonio Linares » Fri May 05, 2023 10:02 am

Dear Dutch,

Please post a small PRG to test, thanks
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: BTNTRNS can use with WINDOW?

Postby dutch » Fri May 05, 2023 10:42 am

Dear Antonio,

I got the problem now. The TRANSLUCENT BUTTONS will work with background image from BRUSH. But it doesn't work with background image from FW_Drawimage().
Antonio Linares wrote:Dear Dutch,

Please post a small PRG to test, thanks
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: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: BTNTRNS can use with WINDOW?

Postby Antonio Linares » Fri May 05, 2023 11:43 am

Please post a small PRG to test :-)
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: BTNTRNS can use with WINDOW?

Postby dutch » Fri May 05, 2023 12:40 pm

Dear Antonio,

This is sample my code. ".\TESTSBTN.JPG' just jpg file for background.
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 := Fw_ReadImage( oWnd, '.\testsbtn.jpg' )

    @ 200, 400 SBUTTON oBtn[1] PROMPT 'Check-Out' OF oWnd ;
                    SIZE 460,460 PIXEL ;           
                    FILE "..\bitmaps\alphabmp\android.bmp" ;
                    FONT oFont40 ;
                    NOBOXTR ;
                    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 ;           
                    FILE "..\bitmaps\alphabmp\design.bmp" ;
                    FONT oFont40 ;                     
                    NOBOXTR ;
                    TEXT ON_BOTTOM ;
                    COLORS CLR_WHITE ;
                    ACTION CheckIn()
                   
   @ 700, 400 BTNBMP oBtn[3] PROMPT " Translucent" + CRLF + "Buttons " OF oWnd ;
                 FILE "..\bitmaps\alphabmp\ichat.bmp" ;
                 SIZE 400,200 PIXEL LEFT 2007 NOBORDER FLAT ;
                 FONT oFont40 COLOR CLR_WHITE,CLR_BLACK

                 oBtn[3]:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }
                   
                   
    @  700,1000 SBUTTON oBtn[4] PROMPT 'Exit' OF oWnd ;
                    SIZE 300,100 PIXEL ;           
                    FONT oFont40 ;                     
                    LOOK W97 ;             
                    ROUNDRECT ;
                    TEXT ON_BOTTOM ;
                    COLORS CLR_WHITE ;
                    ACTION oWnd:End()

ACTIVATE WINDOW oWnd MAXIMIZED ;
            ON PAINT Fw_DrawImage( oWnd, 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 ;  
                   TRANSPARENT

                oDlg:lHelpIcon := .F.

                                 
            ACTIVATE DIALOG oDlg CENTER ON INIT  (ShowImg( oDlg, oBtn ), oDlg:nOpacity := 180)
           
                                 
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,1000 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()
                   
       @ 700, 400 BTNBMP oBtn[3] PROMPT " Translucent" + CRLF + "Buttons " OF oImg ;
                     FILE "..\bitmaps\alphabmp\ichat.bmp" ;
                     SIZE 400,200 PIXEL LEFT 2007 NOBORDER FLAT ;
                     FONT oFont40 COLOR CLR_WHITE,CLR_BLACK
   
                     oBtn[3]:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }                       

return .T.

Antonio Linares wrote:Please post a small PRG to test :-)

https://i.postimg.cc/QMzx3BvM/TESTSBTN.jpg
Image
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: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: BTNTRNS can use with WINDOW?

Postby karinha » Fri May 05, 2023 2:31 pm

Dutch, see if I understand what you want to do.

Dutch, a ver si entiendo lo que quieres hacer.

https://imgur.com/sNg5eE7

Image

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: BTNTRNS can use with WINDOW?

Postby dutch » Sat May 06, 2023 9:10 am

Dear Karinha,

Yes, thank you. I got it by using SBUTTON with Alpha Channel image.

karinha wrote:Dutch, see if I understand what you want to do.

Dutch, a ver si entiendo lo que quieres hacer.

https://imgur.com/sNg5eE7

Image

Regards, saludos.
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: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: BTNTRNS can use with WINDOW?

Postby nageswaragunupudi » Sat May 06, 2023 11:55 am

You can use BTNBMP as transparent buttons too.
Regards

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

Re: BTNTRNS can use with WINDOW?

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

Very Good Dutch, example using BTNBMP.

Code: Select all  Expand view

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

#include 'Fivewin.ch'

STATIC oWnd, nWndWidth, nWndHeight, oFont40

FUNCTION Main()

   LOCAL oCursorBtn := TCursor():New(, 'HAND' )
   LOCAL aImage1, oBtn:= ARRAY(12), oFont, oBrush
   LOCAL cImage := '.\TESTSBTN.JPG'

   SkinButtons()

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

   DEFINE BRUSH oBrush FILE cImage RESIZE // ".\sea.bmp" RESIZE

   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 ) BRUSH oBrush

   // 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 FLAT UPDATE 2007 ;
      COLOR CLR_HCYAN, CLR_WHITE ACTION ( MsgInfo( 'ok1' ) )

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

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

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

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

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

   ACTIVATE WINDOW oWnd MAXIMIZED

   oFont40:End()

RETURN NIL

FUNCTION CheckIn( oBtn )

   LOCAL oDlg, oBrush, cImage := '.\TESTSBTN.JPG'

   DEFINE BRUSH oBrush FILE cImage RESIZE // ".\sea.bmp" RESIZE

   DEFINE DIALOG oDlg SIZE nWndWidth, nWndHeight STYLE nOr( WS_CHILD, WS_POPUP ) ;
      BRUSH oBrush TRANSPARENT

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

RETURN NIL

FUNCTION ShowImg( oDlg, oBtn )

   LOCAL oCursorBtn := TCursor():New(, 'HAND' )

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

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

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

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

   @ 600, 0462 BTNBMP oBtn[06] PROMPT "Back" OF oDlg SIZE 100, 100 PIXEL     ;
      RESOURCE "EXIT" FONT oFont40 NOBORDER TEXT ON_BOTTOM FLAT UPDATE 2007  ;
      COLOR CLR_HCYAN, CLR_WHITE ACTION( oDlg:End() )

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

RETURN( .T. )

// FIN / END - kapiabafwh@gmail.com - Joao Santos - Sao Paulo - Brazil.
 


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: BTNTRNS can use with WINDOW?

Postby karinha » Sat May 06, 2023 12:39 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: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: BTNTRNS can use with WINDOW?

Postby dutch » Sat May 06, 2023 5:05 pm

Thanks All,

I got an idea now.
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: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests