FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Function FadeIn and FadeOut
Posts: 603
Joined: Sun May 04, 2008 08:44 PM

Function FadeIn and FadeOut

Posted: Tue Feb 01, 2011 10:07 PM
News Function 2 Effect

Code (fw): Select all Collapse
#include "FiveWin.ch"

Function Main()
Local oDlg
Define Dialog oDlg Title "Teste" From 0,0 To 300,450 Pixel
// Your code here ....

Activate Dialog oDlg Centered On Init FadeIn(oDlg) Valid FadeOut(oDlg)
Return nil

Function FadeIn(oDlg)
Local nNum
oDlg:Hide()
SetTransparency( oDlg, 0 )
oDlg:Show()
For nNum := 0 TO 255
SetTransparency( oDlg, nNum )
SysRefresh()
Next nNum
Return Nil

Function FadeOut(oDlg)
Local nNum
For nNum := 255 TO 0 STEP -1
SetTransparency( oDlg, nNum )
SysRefresh()
Next nNum
Return .t.

Function SetTransparency( oDlg, nValue )
SetWindowLong( oDlg:hWnd, -20, 524288 )
SetLayeredWindowATTributes( oDlg:hWnd, nRGB(255,0,255), nValue, 2 )
Return Nil


:-)
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM

Re: Function FadeIn and FadeOut

Posted: Tue Feb 01, 2011 10:19 PM

Hi Laiton,

It does not produce any effects in Windows 7 Ultimate...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 603
Joined: Sun May 04, 2008 08:44 PM

Re: Function FadeIn and FadeOut

Posted: Tue Feb 01, 2011 10:24 PM

Yes, because your AERO Theme is enable. =(

:?

Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM

Re: Function FadeIn and FadeOut

Posted: Tue Feb 01, 2011 10:25 PM

OK...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Function FadeIn and FadeOut

Posted: Wed Feb 02, 2011 07:20 AM
With FWH 10.12 onwards:
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg SIZE 600,300 PIXEL TITLE "Dialog Fade"
   oDlg:nOpacity  := 3

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oDlg:show(), dowhile( { || SysWait(.01), ( oDlg:nOpacity += 4 ) < 251 } ) ) ;
      VALID   ( dowhile( { || SysWait(.01), ( oDlg:nOpacity -= 4 ) > 3 } ), .t. )

return nil

procedure dowhile( bCond ); while Eval( bCond ); end; return
Regards



G. N. Rao.

Hyderabad, India
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM

Re: Function FadeIn and FadeOut

Posted: Wed Feb 02, 2011 02:07 PM
Laiton's sample worked for me on FWH10.2, when I included a syswait on the code:
Code (fw): Select all Collapse
#include "FiveWin.ch"

Function Main()
Local oDlg
Define Dialog oDlg Title "Teste" From 0,0 To 300,450 Pixel
// Your code here ....

Activate Dialog oDlg Centered On Init FadeIn(oDlg) Valid FadeOut(oDlg)
Return nil

Function FadeIn(oDlg)
Local nNum
oDlg:Hide()
SetTransparency( oDlg, 0 )
oDlg:Show()
For nNum := 0 TO 255
SetTransparency( oDlg, nNum )
SysRefresh()
SysWait(.0004)
Next nNum
Return Nil

Function FadeOut(oDlg)
Local nNum
For nNum := 255 TO 0 STEP -1
SetTransparency( oDlg, nNum )
SysRefresh()
SysWait(.0004)
Next nNum
Return .t.

Function SetTransparency( oDlg, nValue )
SetWindowLong( oDlg:hWnd, -20, 524288 )
SetLayeredWindowATTributes( oDlg:hWnd, nRGB(255,0,255), nValue, 2 )
Return Nil


Windows 7 Ultimate
I don't know if the speed of the machine may influence the speed of the Fade, I don't have any slow machines to test on (FeedBack may be needed)...

Tested on a Core i5 3.33 GHz with 8GB RAM (Don't ask me why, when it seems that Windows can only manage 4GB)

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

Re: Function FadeIn and FadeOut

Posted: Wed Feb 02, 2011 02:42 PM

Bravo

:P

Marco Boschi
info@marcoboschi.it
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: Function FadeIn and FadeOut

Posted: Wed Feb 02, 2011 04:06 PM

As I understand it, 32bit Windows can only handle 4GB RAM, but 64bit Windows can handle 8GB.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM

Re: Function FadeIn and FadeOut

Posted: Wed Feb 02, 2011 04:21 PM
James Bott wrote:As I understand it, 32bit Windows can only handle 4GB RAM, but 64bit Windows can handle 8GB.

James


You are right:
For what I see in my system, I think it uses 4 for app and the other 4 for file system.
But still useless because file copying in 64 bits is very slow, way slower than 32 bits (when copying large files||like my icon collection )

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM

Re: Function FadeIn and FadeOut

Posted: Wed Feb 02, 2011 04:57 PM

Hi, any 32-bit system can address more than 3.2 GB Ram, but on 64, this is limited to WIndows version, like in home editions 8GB, 16GB in home premium and 128 GB on Ultimate and Enterprise Editions.
in 64 bits, this values changes to user mode 32 bits process, page proof, kernel mode...

Continue the discussion