TO ANTONIO HELP FOR BLINK
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
TO ANTONIO HELP FOR BLINK
Dear Antonio,
Not run
on tled class I insert on new method
if ! Empty( ::oWnd:hWnd )
::Create()
::Default()
::oWnd:AddControl( Self )
else
::oWnd:DefControl( Self )
endif
IF ::lBlink
DEFINE TIMER ::oTmr INTERVAL ::nInterval ACTION ::Blink() OF self
Endif
on Paint method at the init I Insert
IF ::lBlink
IF !::oTmr=NIL
::lStatus:=.t.
::oTmr:Activate()
ENDIF
ENDIF
and this is the blink method
METHOD Blink() CLASS TLED
Local nOpen:= ::nColorLedON
Local nClose:= ::nColorLedOFF
if ::lStatus
::nColorLedON := nClose
else
::nColorLedON := nOpen
endif
::Refresh()
::lStatus := ! ::lStatus
return NIL
I saw when the timer in active the color is before 8388608 and the is nil and it continue
I insert at init on Paint method this line :
::nColorLedON := IIF (::lBlink,::Blink(),::nColorLedON)
It seem to run but the when the lstatus is .f. it not put the right color but NIL
and ::oTmr is allways NIL
Not run
on tled class I insert on new method
if ! Empty( ::oWnd:hWnd )
::Create()
::Default()
::oWnd:AddControl( Self )
else
::oWnd:DefControl( Self )
endif
IF ::lBlink
DEFINE TIMER ::oTmr INTERVAL ::nInterval ACTION ::Blink() OF self
Endif
on Paint method at the init I Insert
IF ::lBlink
IF !::oTmr=NIL
::lStatus:=.t.
::oTmr:Activate()
ENDIF
ENDIF
and this is the blink method
METHOD Blink() CLASS TLED
Local nOpen:= ::nColorLedON
Local nClose:= ::nColorLedOFF
if ::lStatus
::nColorLedON := nClose
else
::nColorLedON := nOpen
endif
::Refresh()
::lStatus := ! ::lStatus
return NIL
I saw when the timer in active the color is before 8388608 and the is nil and it continue
I insert at init on Paint method this line :
::nColorLedON := IIF (::lBlink,::Blink(),::nColorLedON)
It seem to run but the when the lstatus is .f. it not put the right color but NIL
and ::oTmr is allways NIL
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TO ANTONIO HELP FOR BLINK
Silvio,
In your code, Activate the timer right after creating it:
DEFINE TIMER ...
ACTIVATE TIMER ...
In your code, Activate the timer right after creating it:
DEFINE TIMER ...
ACTIVATE TIMER ...
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TO ANTONIO HELP FOR BLINK
I modify on New method
IF ::lBlink
DEFINE TIMER ::oTmr INTERVAL ::nInterval ACTION ::Blink() OF self
ACTIVATE TIMER ::oTmr
ENDIF
but not run also
the procedure not activate the time and not change the colors of Leds
IF ::lBlink
DEFINE TIMER ::oTmr INTERVAL ::nInterval ACTION ::Blink() OF self
ACTIVATE TIMER ::oTmr
ENDIF
but not run also
the procedure not activate the time and not change the colors of Leds
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TO ANTONIO HELP FOR BLINK
...
Last edited by Silvio.Falconi on Fri Apr 08, 2016 9:05 am, edited 1 time in total.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TO ANTONIO HELP FOR BLINK
I modify now:
DATA oOut READONLY
DATA nTime READONLY AS NUMERIC INIT 0
METHOD Initiate( hDlg ) INLINE Super:Initiate( hDlg ), ::Default()
on New method
if ! Empty( ::oWnd:hWnd )
::Create()
::oWnd:AddControl( Self )
else
::oWnd:DefControl( Self )
endif
on Default method
IF ::lBlink
DEFINE TIMER ::oOut INTERVAL ::nInterval OF ::oWnd ACTION ( ::nTime ++,::Blink())
ACTIVATE TIMER ::oOut
ENDIF
Now on interval change the color but then not return that was before!!
DATA oOut READONLY
DATA nTime READONLY AS NUMERIC INIT 0
METHOD Initiate( hDlg ) INLINE Super:Initiate( hDlg ), ::Default()
on New method
if ! Empty( ::oWnd:hWnd )
::Create()
::oWnd:AddControl( Self )
else
::oWnd:DefControl( Self )
endif
on Default method
IF ::lBlink
DEFINE TIMER ::oOut INTERVAL ::nInterval OF ::oWnd ACTION ( ::nTime ++,::Blink())
ACTIVATE TIMER ::oOut
ENDIF
Now on interval change the color but then not return that was before!!
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TO ANTONIO HELP FOR BLINK
Silvio,
If you don't know how to fix your code, post your class source code here and we will test it.
If you don't know how to fix your code, post your class source code here and we will test it.
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TO ANTONIO HELP FOR BLINK
ok , but I wish finish it . on myself then, as I sad to you in private mail, I can publish the class.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: TO ANTONIO HELP FOR BLINK
Silvio,
if you plan to share it, why don't you share it now so others can help you ?
if you plan to share it, why don't you share it now so others can help you ?
Re: TO ANTONIO HELP FOR BLINK
Hello..
If you don't mind please test this..
Thank you
Best Regards
Fafi
If you don't mind please test this..
Thank you
Best Regards
Fafi
Code: Select all
#include "fivewin.ch"
static oTimer, oSay , lOn, oSay1, oSay2
function Main()
lOn := .f.
define dialog oDlg from 1,1 to 200,200 pixel
define timer oTimer interval 500 action Blinker(oDlg)
@10,10 say oSay prompt "Blink" size 30,12 of oDlg pixel
@30,10 say oSay1 prompt "(^-^)" size 30,12 of oDlg pixel
@30,10 say oSay2 prompt "____" size 30,12 of oDlg pixel
activate DIALOG oDlg CENTERED on init ( oTimer:hWndOwner := oDlg:hWnd, oTimer:Activate() )
return nil
static function Blinker(oDlg)
oTimer:deactivate()
if lOn
oSay:Hide()
oSay1:Hide()
oSay2:Show()
else
oSay:Show()
oSay2:Hide()
oSay1:Show()
endif
oDlg:cTitle := time()
lOn := !lOn
oTimer:activate()
return nil
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: TO ANTONIO HELP FOR BLINK
I resolved antonio
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC