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
How Can I flash the CAPTION of a DCSTATIC object ?
Re: How Can I flash the CAPTION of a DCSTATIC object ?
Try this:
or 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
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'
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: How Can I flash the CAPTION of a DCSTATIC object ?
I would suggest another thread to do this.
Compile and run the below sample.
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
The eXpress train is coming - and it has more cars.