How to make a TBTNBMP transparent

Post Reply
bterce@matrixcomputer.com
Posts: 10
Joined: Mon Mar 05, 2007 11:18 pm
Location: Southern California

How to make a TBTNBMP transparent

Post by bterce@matrixcomputer.com »

Hi,

I am dynamically creating a BTNBMP (not from resource) to a window and I can't make it transparent. However, if I do it from a Resource dialog, it works. How can I do it without using a Resource dialog?

This one works for a Resource dialog:
REDEFINE BTNBMP oBTN RESOURCE "TEST" OF oDLG NOBORDER
oBTN:LTRANSPARENT:=.T.

However this one doesn't : (displays bitmap but not transparent)
@100,100 BTNBMP oBTN RESOURCE "TEST" SIZE 280,110 OF oWND NOBORDER
oBTN:LTRANSPARENT:=.T.


Thanks
Bert
bterce@matrixcomputer.com
Posts: 10
Joined: Mon Mar 05, 2007 11:18 pm
Location: Southern California

More

Post by bterce@matrixcomputer.com »

I am using a BRUSH in my window thats why I want the BTNBMP to be trasparent.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Bert,

Here you have a working sample:

Code: Select all

// Testing a transparent TBtnBmp on a transparent DialogBox

#include "FiveWin.ch"

function Main()

   local oBru, oDlg, oBtn

   DEFINE BRUSH oBru FILENAME "../bitmaps/Backgrnd/beach.bmp"

   DEFINE DIALOG oDlg SIZE 400, 200 BRUSH oBru TRANSPARENT

   @ 70, 80 BTNBMP oBtn FILENAME "../bitmaps/yes.bmp" ;
      SIZE 50, 30 OF oDlg NOBORDER ACTION MsgInfo( "click" )

   oBtn:lTransparent = .T.   

   ACTIVATE DIALOG oDlg CENTERED

return nil
Please notice the use of the clause TRANSPARENT when defining the dialog too
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
bterce@matrixcomputer.com
Posts: 10
Joined: Mon Mar 05, 2007 11:18 pm
Location: Southern California

Post by bterce@matrixcomputer.com »

Thank you Antonio, it works when used in a Dialog, but how can you do it in a Window? There is no TRANSPARENT clause when defining a Window.

Thanks again,
Bert
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Bert,

Currently is supported for dialogboxes only
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply