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

User avatar
Antonio Linares
Site Admin
Posts: 42519
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Post by Antonio Linares »

James,

FWH uses a Windows standard control ("static") for the SAYs. This way standard static controls can be used from the resources editors.

I guess that TSSay implements a user defined control to solve those limitations.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

James Bott wrote: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


Dear James,

That's it! With native say control, if works, is too much complicated!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
Antonio Linares
Site Admin
Posts: 42519
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Post by Antonio Linares »

Júlio,

Here you have a working example :-)

test.prg

Code: Select all | Expand

#include "FiveWin.ch" 

function Main()

   local oDlg, oBmp, oFont

   DEFINE FONT oFont NAME "Verdana" SIZE 0, -16 BOLD

   DEFINE DIALOG oDlg RESOURCE "Test" COLOR "N/B"
   
   REDEFINE BITMAP oBmp ID 100 OF oDlg FILENAME "test.bmp"
   
   oBmp:bPainted = { | hDC | oBmp:Say( 12, 20, "Cadastro Plano de Contas",,, oFont, .T., .T. ) }

   ACTIVATE DIALOG oDlg CENTERED
   
   oFont:End()

return nil

test.rc

Code: Select all | Expand

test DIALOG 98, 55, 185, 147
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Test"
FONT 8, "MS Sans Serif"
{
 CONTROL "", 100, "TBitmap", 0 | WS_CHILD | WS_VISIBLE, 0, -1, 185, 29
 DEFPUSHBUTTON "OK", 1, 67, 128, 50, 14
}

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Antonio, James, Uwe and friends!

It's works now! With very much strength!! :)

This is my generic user function:

Code: Select all | Expand

FUNCTION aplImage( oDlg, nId, cResNome, lTransparente, lStretch, cLabel )

LOCAL oBitmap

DEFAULT lTransparente := .F.            , ;
        cResNome      := "IMG_BARRA_TOP", ;
        nId           := 100            , ;
        lStretch      := .F.            , ;
        cLabel        := NIL


oBitmap := TBitmap():redefine( nId, cResNome,, oDlg,,,, lStretch,,,,,, lTransparente )

IF !empty( cLabel )
   oBitmap:bPainted = {|hDC| oBitmap:say( 12, 20, cLabel,,, TFont():new( "Tahoma", 0, 25,, .T. ), .T., .T. ) }
ENDIF

RETURN( oBitmap )
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
Antonio Linares
Site Admin
Posts: 42519
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Post by Antonio Linares »

Julio,

You have to modify your function as you are creating fonts and you are not releasing them:

Code: Select all | Expand

FUNCTION aplImage( oDlg, nId, cResNome, lTransparente, lStretch, cLabel ) 

LOCAL oBitmap

static oFont

DEFAULT lTransparente := .F.            , ;
        cResNome      := "IMG_BARRA_TOP", ;
        nId           := 100            , ;
        lStretch      := .F.            , ;
        cLabel        := NIL

oBitmap := TBitmap():redefine( nId, cResNome,, oDlg,,,, lStretch,,,,,, lTransparente )

IF ! Empty( cLabel )
   if oFont == nil
      oFont = TFont():new( "Tahoma", 0, 25,, .T. )
   endif
   oBitmap:bPainted = {|hDC| oBitmap:Say( 12, 20, cLabel,,, oFont, .T., .T. ) }
ENDIF

RETURN oBitmap
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Thank you Linares!

I have changed my source!

Antonio, no have a way for redefine the say with this syntax and with the same effect of a bPainted call?

REDEFINE SAY ... TRANPARENT
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
Antonio Linares
Site Admin
Posts: 42519
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Post by Antonio Linares »

Júlio,

No, not yet
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply