How Can I flash the CAPTION of a DCSTATIC object ?

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

How Can I flash the CAPTION of a DCSTATIC object ?

#1 Post 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

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: How Can I flash the CAPTION of a DCSTATIC object ?

#2 Post 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'
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How Can I flash the CAPTION of a DCSTATIC object ?

#3 Post 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
The eXpress train is coming - and it has more cars.

Post Reply