Page 1 of 1
How Can I flash the CAPTION of a DCSTATIC object ?
Posted: Tue Nov 30, 2010 4:03 am
by unixkd
Hi guys
How Can I flash the CAPTION of a DCSTATIC object at runtime ? I want to change the caption of one static object to say "waiting !!!"
Thanks.
J.O. Owoyemi
Re: How Can I flash the CAPTION of a DCSTATIC object ?
Posted: Tue Nov 30, 2010 6:07 am
by Tom
Try this:
Code: Select all
@ 1,1 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT CAPTION 'Hello' SIZE 10,1 OBJECT oSay // creates a text static
* somewhere in your code:
oSay:SetCaption('Waiting ...') // changes the caption
or this:
Code: Select all
lState := .F.
@ 1,1 DCSAY {||TextCaption(lState)} SIZE 10,1 OBJECT oSAy // creates a text static
* function called to change the caption, call DC_GetRefresh(GetList) or. DC_GetRefresh(oSay) afterwards!
FUNCTION TextCaption(lWait)
IF lWait
RETURN 'Waiting ...'
ENDIF
RETURN 'Hello'
Re: How Can I flash the CAPTION of a DCSTATIC object ?
Posted: Tue Nov 30, 2010 9:57 am
by rdonnay
I would suggest another thread to do this.
Compile and run the below sample.
Code: Select all
#INCLUDE "dcdialog.CH"
LOCAL GetList[0], dDate := CtoD(''), oStatic, lTerminateThread := .f.
@ 0,0 DCSAY 'You must enter a Date!!!' SAYSIZE 0 ;
FONT '14.Arial Bold' COLOR GRA_CLR_RED OBJECT oStatic
@ 2,0 DCSAY 'Enter Date' GET dDate POPUP {|d|DC_PopDate(d,,,,,,2)} ;
SAYSIZE 0 SAYBOTTOM
DCREAD GUI FIT TITLE 'Flashing a Static' ;
EVAL {|o|o := Thread():new(), Sleep(5), ;
o:start({||FlashStatic(oStatic,@dDate,@lTerminateThread)})}
lTerminateThread := .t.
RETURN nil
PROC appsys ; RETURN
STATIC FUNCTION FlashStatic(oStatic,dDate,lTerminateThread)
LOCAL i, cCaption := oStatic:caption
DO WHILE Empty(dDate) .AND. !lTerminateThread
Sleep(50)
oStatic:setCaption('')
Sleep(50)
oStatic:setCaption(cCaption)
ENDDO
oStatic:setCaption('Thank you!')
RETURN nil