Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A question about the clock.

Status
Not open for further replies.

Rosciano

Technical User
Jun 16, 2003
64
IT
Hello,
I am translating a book for my class "How programming started ..." from English to Spanish. However, I did not answer a question from a student.

A week ago, during a dBase brush up; while we were examining ASSIST, he asked me: "how does the clock works continuously" referring to a clock put at the beginning of the page which, with the program not working, showed the actual time running the hour, minutes and seconds.
I was afraid of this question; I had already examined the code, but without results and the book I had was very frugally with the matter.
I couldn't answer the question. [sad]

Is there someone who can help me with the dBase code for this watch?

Thanks very much.



 
In dBase V it was possible for the user to add the clock to a to an individual program and specify its location on the screen.
The commands for this; Set Clock on or off) and Set Clock to [row, column].
New versions of dBase contained improvements on the previous version; dBase III plus contained commands that dBase III dis not have and dBase III had commands that dBase II did not have, etc. dBase is now up to version 8.1
 
Here I have a couple of old (used) books from the "Qsborne / McGraw-Hill", both original from 1977, and in any of them, specifically in Using dBase III Plus, the famous clock already appears on the ASSIST page.

In 1977?

I have no idea when dBase V came out, but surely AFTER dBase III, dBase IV and before they wrote it in these old books, let alone dBase III.
I agree with you that a piece of other software was included, that explains how there is no way to do it with dBase III, but it is not a piece of dBase V.

Come to think of it, I don't think they have mixed software, the code is written in dBase III !, but how?

 
Hi,
You should look into the history of dBase under Ashton Tate (owners).
The following shows approximate dates of new releases for dBase:-
1983 dBase II
1984 dBase III
1986 dBase III plus
1988 dBase IV (versions 1 and 2)
1994 dBase V


All new releases introduced new commands and functions.
I am not sure what you are not understanding about new releases or updates.

 
Thank you for the dates.
Anyway, the books I have were printed BEFORE any of those occasions (1977).
How can you be so sure a piece of dBase V was added if you don't even know the code? Do you imagine?
Can you prove it?


 
When the updates were released Ashton Tate would list the new commands/functions with descriptions and examples.
This is what normally happens when updates are released for any software.


 
"When the updates were released Ashton Tate would list the new commands/functions with descriptions and examples.
This is what normally happens when updates are released for any software."



OK this is known, but this does not answer my concerns, nor the fact of the dates.
Ashton Tate knew beforehand dBase V ...

 
I do not know what your concerns are. It is a fact that the user cannot move or set the clock on or off in dBase III plus!
What do you mean by Ashton Tate knew beforehand dBase V ... ???
 
Thank you very much.
[smile]


beforehand = at an earlier time
These words mean at an earlier time.

 
I know what beforehand means. How could they know about dBase 5 when dBase III plus was the latest version ??
Just to clarify; many amendments/additions were introduced in dBase 4 and 5 that were not available in 3 plus.
Ask Joe, as he already knows about some of the dBase history.
 
Pardon!!
I misread the book's date. The correct date is 1987
I'am sorry... [sad]








 
I did it (without dBase V), of corse, with adding some stuff (how to stop)

Code:
*DO.PRG
*
store 0 to ab,ad,ac,cd          && preparing the varibles to be used
waa=' '
*
clear
DO WHILE .T.
    if ad=0
        do while ac=ab
            ab=ab+1
        enddo
        if ac=ab-1
            store substr(time(),1,8) to waa
        endif
        @ 14,36 say WAA 
        cd = inkey()
        if cd <> 0                 && the program stops with any key pressed
            exit
        endif
    endif
ENDDO

 
Hi Rosciano,
Have you tried this? At first glance it looks okay but I will try it in Visual FoxPro because it uses the same language as dBase and will let you know.
 
Hi Rosciano,
Yes your program works perfectly. It probably needs a clear command before exit, but you may not want to clear the screen for some reason.
 
Tried!
It's has worked for two and a half days on one of my applications that I use frequently.

 
Hi Rosciano,
Instead of cd=inkey() etc. you could put the following

If inkey()=27 && user presses escape key
EXIT
endif
 
If you notice any "flickers" in the time, add the following:

Code:
*
store 0 to ab,ad,ac,cd,CT          && preparing the varibles to be used
waa=' '
*
clear
DO WHILE .T.
    if ad=0
        do while ac=ab
            ab=ab+1
        enddo
        if ac=ab-1
            store substr(time(),1,8) to waa
        endif
        

*-----The number "30" could be "15, 20, 30, 45, 50,..." it depends on how  
*-----much time we want to give it.
        DO WHILE CT<30
            CT=CT+1
        ENDDO
        CT=0
        

        @ 14,36 say WAA 
        cd = inkey()
        if cd <> 0                 && the program stops with any key pressed
            exit
        endif
    endif
ENDDO




 
Hi,
If I want to add the clock to a program that for example produces an input screen then the exit procedure would have to be modified?
I will try to run this with another program and let you know. Your program is a benefit to users still operating Dbase III plus.

 
Good Day,

Next, I show how I inserted it into a program that I use frequently:

Code:
    CLEAR
    option=' '
    
    set color to n+/b
    @ 24,1 say 'Date:'
    @ 24,6 say date()
    @ 24,65 say 'Hour:'
    set color to gr+/r
    @ 24,30 say ' Press any to Start '
    store 0 to ab,ac,ad,cd,ct
    waa=' '
    DO WHILE .T.
        if ad=0
            do while ac=ab
                ab=ab+1
                set color to n+/b
            enddo
            if ac=ab-1
                store substr(time(),1,8) to waa
            endif
            ac= ab-1
            @ 24,70 say WAA 
            DO WHILE CT<30
                CT=CT+1
            ENDDO
            cd = inkey()
            if cd <> 0
                exit
            endif
        endif
    ENDDO    
    @ 24,1 clear to 24,78
    Set color to w+/b
    @ 24,29 say 'Your Option?:' get option pict '@!'	
    READ

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top