Page 1 of 2

"REDEFINE SAY ... TRANSPARENT" not work! SOLVED!

PostPosted: Wed Aug 27, 2008 5:48 pm
by JC
Dear Antonio and friends!

* New: REDEFINE SAY ... TRANSPARENT already available. No need to declare a variable to hold the SAY object to set its transparency.

My syntax is here:
Code: Select all  Expand view
REDEFINE SAY PROMPT "Test oSay Transparent" ID 4001 OF oDlg FONT ( TFont():new( "Tahoma", 0, 25,, .T. ) ) TRANSPARENT

But, still not work!

Redefine SAY transparent

PostPosted: Wed Aug 27, 2008 6:10 pm
by ukoenig
Hello JC,

i couldn't detect any problem.

As you can see : a transparent SAY on Gradient-background.
Value 0.50 is a GET

The say-text is directly written inside the resource. !!!!

I didn't use REDEFINE SAY

Image

Regards
Uwe :lol:

PostPosted: Wed Aug 27, 2008 6:24 pm
by JC
Uwe, this is my REDEFINE SAY into our application:

Image

It's on top of a bitmap image from resource!
Not works!

Transparent SAY

PostPosted: Wed Aug 27, 2008 6:29 pm
by ukoenig
Hello JC,

I understand.
This is complete different ( Text on BMP ).
I will give you a source-sample for this in this topic.

Regards
Uwe :lol:

Re: Transparent SAY

PostPosted: Wed Aug 27, 2008 6:31 pm
by JC
ukoenig wrote:Hello JC,

I understand.
This is complete different ( Text on BMP ).
I will give you a source-sample for this in this topic.

Regards
Uwe :lol:


Uew, please send me on julio.mferreira@gmail.com! And thanks!

PostPosted: Wed Aug 27, 2008 6:32 pm
by Antonio Linares
Júlio,

Are you using a BRUSH from a bitmap for the Dialog ?

PostPosted: Wed Aug 27, 2008 6:37 pm
by JC
Antonio Linares wrote:Júlio,

Are you using a BRUSH from a bitmap for the Dialog ?


Antonio, not! I'm using this way:
Code: Select all  Expand view
TBitmap():redefine( nId, cResName,, oDlg,,,, lStretch,,,,,, lTransparent )

PostPosted: Wed Aug 27, 2008 6:39 pm
by Antonio Linares
Júlio,

Then try to use:

oBitmap:Say( nRow, nCol, cText, ... )

METHOD Say( nRow, nCol, cText, nClrFore, nClrBack, oFont, lPixel,;
lTransparent, nAlign )

PostPosted: Wed Aug 27, 2008 6:47 pm
by JC
Antonio Linares wrote:Júlio,

Then try to use:

oBitmap:Say( nRow, nCol, cText, ... )

METHOD Say( nRow, nCol, cText, nClrFore, nClrBack, oFont, lPixel,;
lTransparent, nAlign )


Antonio,

I tried with this implementation, but not works!
Code: Select all  Expand view
       oBitmap := TBitmap():redefine( 100, "IMG_BARRA_TOP",, oDlg )
       oBitmap:say( 2, 2, "Cadastro Plano de Contas",,,,, .T. )


This the result image:
Image

PostPosted: Wed Aug 27, 2008 6:50 pm
by Antonio Linares
Julio,

You have to do that call from the ON INIT of the dialog:

ACTIVATE DIALOG oDlg ;
ON INIT oBitmap:Say( 2, 2, "Cadastro Plano de Contas",,,,, .T. )

PostPosted: Wed Aug 27, 2008 6:51 pm
by Antonio Linares
And remove the SAY control ! ("text") :-)

PostPosted: Wed Aug 27, 2008 6:52 pm
by Antonio Linares
In fact, it should be used from the ON PAINT, to properly refresh:

ACTIVATE DIALOG oDlg ;
ON PAINT oBitmap:Say( 2, 2, "Cadastro Plano de Contas",,,,, .T. )

PostPosted: Wed Aug 27, 2008 6:59 pm
by JC
Antonio,

My code:

Code: Select all  Expand view
DEFINE DIALOG oDlg RESOURCE "DEFAULT_FORM" OF oWnd ICON oIcon

       oBitmap := TBitmap():redefine( 100, "IMG_BARRA_TOP",, oDlg )
       
       ...

ACTIVATE DIALOG oDlg CENTER ON PAINT ( oBitmap:say( 2, 2, "Cadastro Plano de Contas",,,,, .T. ) )

Sorry, but still not work!

We using the class TSSay with syntax REDEFINE SENSITIVE SAY ... TRANSPARENT and this works fine!
I really want to use the native class of FWH with transparency! It's very better than!

Text-Writing on BMP

PostPosted: Wed Aug 27, 2008 7:03 pm
by ukoenig
Hello JC,

Like Antonio told you : You have to use ONPAINT, to solve your problem.

Here is just a quick sample, how i use text-writing on BMP's from Resource on any places.
The BMP-resource is filled with a brush or color, then a text is painted.
I use it for my Title-paintings.
Maybe you can find some informations on it.

The resource < Blanc > is a small BMP inside the resource, used as container. ID 100 is your BMP with the original size.
POSLEFT defines the needed left-position of the text.
The top-position of the text is calculated from the font- and BMP-height,
to center the text vertical.

Code: Select all  Expand view

REDEFINE BITMAP oBmp1  ID 100 ADJUST RESOURCE "Blanc"  OF oDlg1
oBmp1:bPainted := { |hDC|OnPaint( oDlg1,hDC,oBMP1, "Your Text", oFont, POSLEFT ) }

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

FUNCTION ONPAINT(oDlg1,hDC,oBmp,cText, oBFont,nPOSLEFT )
LOCAL hOldFont, oNewbrush, hBitmap, aRect, nTOP, nLEFT

hOldFont := SelectObject( hDC, oBFont:hFont )

// find the text-length

nTXTLG :=  GettextWidth( hDC, cText )

nBMPLONG  := oBmp:Super:nWidth()
nBMPHIGHT := oBmp:Super:nHeight()
nFONTHIGHT := oBfont:nInpHeight * -1

// The text-pos is calculated

nLEFT := 5

IF nPOSLEFT = 0
   // Center-position in BMP if POSLEFT = 0
   nLEFT := (nBMPLONG - nTXTLG) / 2 
ELSE
   // defined left-position
   nLEFT := nPOSLEFT 
ENDIF

nNEWHIGHT := nFONTHIGHT

// Text-top-position is calculated.

nTOP := (nBMPHIGHT - nNEWHIGHT) / 2

aRect := GETCLIENTRECT( oBmp:hWnd )

oBmp:oBrush := oNewbrush

SetTextColor( hDC,nColor)
SetBkMode( oBmp:hDC, 0 )

// Fills your BMP with a brush

FillRect( hDC, aRect, oBmp:oBrush:hBrush )

IF nPOSLEFT > 0
     TextOut( hDC, nTOP, nLEFT, cText )
ELSE
     TextOut( hDC, nTOP, nLEFT, cText )
ENDIF
SelectObject( hDC, hOldFont )

RETURN NIL



Regards
Uwe

PostPosted: Wed Aug 27, 2008 11:10 pm
by James Bott
Uwe,

>Like Antonio told you : You have to use ONPAINT, to solve your problem.

I think what JC is saying is that the 3rd-party product, sensitive SAY, does work without being called from ON PAINT, so it is techinically possible. He hopes that Antonio can achive the same with the native FW SAY. I hope so too.

James