@ x,y TSay con Transparencias

@ x,y TSay con Transparencias

Postby Daniel Garcia-Gil » Wed Mar 04, 2009 5:45 pm

Cambios a la clase TSay para las transparencias...
Mod TSay class for transparents

este cambio viene del hecho que exista la clausula TRANSPARENT en el REDEFINE del SAY y no en @ x,y SAY
This change comes from the fact that there is a clause TRANSPARENT in REDEFINE SAY and not in @ x, y SAY

Comenzamos/Start
Este Link es un Exe si quieren probar antes de hacer cambios
this link is EXE, if you want to try first before making any changes ...

http://www.sitasoft.com/fivewin/test/testsay.rar

testsay.exe con temas / with themes
testsay1.exe sin temas / without themes

archivos a editar/file to edit
fivewin.ch
say.prg

method a modificar en say.prg/ method to change in say.prg
method new
method Initiate


abrir/open fivewin.ch

buscar/find

Code: Select all  Expand view
#xcommand @ <nRow>, <nCol> SAY [ <oSay> <label: PROMPT,VAR > ] <cText> ;
             [ <pict: PICT, PICTURE> <cPict> ] ;
             [ <dlg: OF,WINDOW,DIALOG > <oWnd> ] ;
             [ FONT <oFont> ]  ;
             [ <lCenter: CENTERED, CENTER > ] ;
             [ <lRight:  RIGHT >    ] ;
             [ <lBorder: BORDER >   ] ;
             [ <lPixel: PIXEL, PIXELS > ] ;
             [ <color: COLOR,COLORS > <nClrText> [,<nClrBack> ] ] ;
             [ SIZE <nWidth>, <nHeight> ] ;
             [ <design: DESIGN >  ] ;
             [ <update: UPDATE >  ] ;
             [ <lShaded: SHADED, SHADOW > ] ;
             [ <lBox:    BOX   >  ] ;
             [ <lRaised: RAISED > ] ;
             [ <adj: ADJUST> ] ;


agregar despues / add after
Code: Select all  Expand view
            [ <lTrans: TRANSPARENT>];  


buscar/find
Code: Select all  Expand view
         [ <oSay> := ] TSay():New( <nRow>, <nCol>, <{cText}>,;
             [<oWnd>], [<cPict>], <oFont>, <.lCenter.>, <.lRight.>, <.lBorder.>,;
             <.lPixel.>, <nClrText>, <nClrBack>, <nWidth>, <nHeight>,;
             <.design.>, <.update.>, <.lShaded.>, <.lBox.>, <.lRaised.>, <.adj.> )


en la linea buscar/ inline find
Code: Select all  Expand view
<.adj.> )


cambiar por / change with
Code: Select all  Expand view
<.adj.>, <.lTrans.> )


abrir/open say.prg

buscar en methodo NEW/find in Method New
Code: Select all  Expand view
METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont,;
            lCentered, lRight, lBorder, lPixels, nClrText, nClrBack,;
            nWidth, nHeight, lDesign, lUpdate, lShaded, lBox, lRaised, lAdjust ) CLASS TSay


en linea buscar/ inline find
Code: Select all  Expand view
lAdjust )


cambiar con/ replace with

Code: Select all  Expand view
lAdjust, lTransparent )


buscar/find
Code: Select all  Expand view
lAdjust  := .f.


en linea agregar despues/ inline add after
Code: Select all  Expand view
, lTransparent := .f.


buscar/find
Code: Select all  Expand view
  ::lAdjust   = lAdjust


agregar despues/add after
Code: Select all  Expand view
  ::lTransparent := lTransparent

   if ! IsAppThemed()
      if ::lTransparent
         if ! Empty( ::oWnd:oBrush ) .and. !empty( ::oBrush )
            ::SetBrush( ::oWnd:oBrush )
         endif
      endif
   endif
 


buscar en method initiate/ find in method initiate
Code: Select all  Expand view
if ! Empty( ::oWnd:oBrush:hBitmap )


en linea agregar despues/ inline add after
Code: Select all  Expand view
.and. !empty( ::oBrush )


ejemplo/example




Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

local oWnd
local oMenu

menu oMenu
   menuitem "Gradient" action Dlg_Grad()
   menuitem "Color" action Dlg_Color()
   menuitem "Bitmap" action Dlg_Bit()
endmenu

DEFINE WINDOW oWnd TITLE "Test Say" from 0,0 to 400,800 pixel menu oMenu

activate window oWnd

return nil

procedure Dlg_Grad

local oDlg
local oSay
local oSay2

   define dialog odlg title "Test Say With Gradient Brush" size 400,400 PIXEL
   
   @ 2,2 to 100,100 of odlg pixel
   
   @ 25,15 say oSay prompt "This a Test" of oDlg SIZE 40, 15 COLOR CLR_WHITE PIXEL  transparent adjust
 
   @ 10,120 button "Test" pixel action  oSay:SetText( "Change Text")  

   
   ACTIVATE DIALOG oDlg CENTERED  ;
      ON INIT GradientBrush( oDlg, { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
                                     { 0.6, nRGB( 24,  61, 118 ), nRGB( 50, 95, 158 ) } } )
   
return

procedure Dlg_Color

local oDlg
local oBrush
local oSay


   define brush oBrush color CLR_CYAN
   
   define dialog odlg title "Test Say With Color Brush" brush oBrush size 400,400 PIXEL
   
   @ 2,2 say oSay prompt "This a Test" of oDlg SIZE 100, 130 COLOR CLR_WHITE PIXEL  transparent

   @ 10,120 button "Test" action oSay:SetText( "Change Text")  pixel

   
   ACTIVATE DIALOG oDlg CENTERED
   
   
return

procedure Dlg_Bit

local oDlg
local oBrush
local oSay

   define brush oBrush file "cara.bmp"
   
   define dialog odlg title "Test Say With bitmap Brush" brush oBrush size 400,400 PIXEL
   
   @ 2,2 say oSay prompt "This a Test" of oDlg SIZE 100, 130 COLOR CLR_WHITE PIXEL  transparent

   @ 10,120 button "Test" pixel action oSay:SetText( "Change Text")  

   
   ACTIVATE DIALOG oDlg CENTERED on init osay:refresh()
   
return

function GradientBrush( oDlg, aColors )

   local hDC, hBmp, hBmpOld, oBrush
   
   if Empty( oDlg:oBrush:hBitmap )
      hDC = CreateCompatibleDC( oDlg:GetDC() )
      hBmp = CreateCompatibleBitMap( oDlg:hDC, oDlg:nWidth, oDlg:nHeight )
      hBmpOld = SelectObject( hDC, hBmp )
      GradientFill( hDC, 0, 0, oDlg:nHeight, oDlg:nWidth, aColors )
      DeleteObject( oDlg:oBrush:hBrush )
      oDlg:oBrush:hBitmap = hBmp
      oDlg:oBrush:hBrush = CreatePatternBrush( hBmp )
      SelectObject( hDC, hBmpOld )
      oDlg:ReleaseDC()
   endif  

return nil


RC
Code: Select all  Expand view
// Add this to your resources RC file

#ifdef __FLAT__
   1 24 "WindowsXP.Manifest"
#endif
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: @ x,y TSay con Transparencias

Postby cuatecatl82 » Fri Mar 06, 2009 3:59 pm

Gracias Tocayo....

Estaba buscando algo parecido a esto desde hace tiempo, tenia pensado hacer unas modificaciones a la clase TSay, pero por falta de tiempo lo deje para otra ocasión...

Bajo y hago las modificaciones mencionadas y comento como me fue...

Muchas gracias, me ahorraste algo de tiempo...
Soluciones y Diseño de Software
Damos Soluciones...

I.S.C. Victor Daniel Cuatecatl Leon
Director y Diseñador de Proyectos

http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
User avatar
cuatecatl82
 
Posts: 625
Joined: Wed Mar 14, 2007 6:49 pm
Location: San Cristobal de las Casas, Chiapas México

Re: @ x,y TSay con Transparencias

Postby Daniel Garcia-Gil » Fri Mar 06, 2009 4:09 pm

Gracias por tu respuesta,

Es bueno saber que alguien mas lo prueba y que estos cambios se puedan depurar, en caso de ser necesario y estar atentos a posibles mejoras planteadas de los mismo
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests