Page 1 of 1

How to make a TBTNBMP transparent

Posted: Tue Apr 10, 2007 1:01 am
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

More

Posted: Tue Apr 10, 2007 1:12 am
by bterce@matrixcomputer.com
I am using a BRUSH in my window thats why I want the BTNBMP to be trasparent.

Posted: Tue Apr 10, 2007 5:28 am
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

Posted: Tue Apr 10, 2007 1:04 pm
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

Posted: Thu Apr 12, 2007 6:11 am
by Antonio Linares
Bert,

Currently is supported for dialogboxes only