Announcement

Collapse
No announcement yet.

Update display after regaining focus

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Billy Scherz
    Guest replied
    I inserted the asm code into our sleeper function. The testing I've completed so far shows it does update past midnight now, but also updates the time without the program having the focus.

    Thanks

    ------------------

    Leave a comment:


  • Billy Scherz
    Guest replied
    Lance,
    The program updates after it regains the focus except for over midnight, the loop displays a menu. I found the code you mentioned I haven't had a chance to test it yet.

    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    Billy, you need to post more of the code in your initial posting... it is not shown how this code actually loops.

    BTW, does the display update correctly at other times when the DOS window does not have focus? You are not very clear on what *exactly* happens, and we can only guess unless we can see the remainder of the code.

    FYI, when a DOS app is windowed, the screen display is only updated by Windows periodically - this may have some effect on your display. However, in full-screen mode you should not see any such "delay" in the screen update.

    Additionally, you may want to consider releasing time slices to Windows in your "do nothing" loops. If you check through this forum, you should find the code that does this with an interrupt call (I'm not at my DEV PC to dig the code up and post it).


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Billy Scherz
    Guest replied
    Tom,
    That does explain some debugging output I was getting, I don't see how that would affect the date and time update when the program does not have the focus.

    ------------------

    Leave a comment:


  • Tom Hanlin
    replied
    You've got a problem here:

    Code:
      t!=TIMER 'not work correctly or even consistantly
      NewT! = (t!+Seconds!) MOD %MaxSeconds
      WHILE t! < NewT! AND NOT INSTAT
    Consider what happens to NewT! when the current time, plus
    Seconds!, goes past midnight. Due to the MOD, NewT! rolls over
    to a low number, but t! is still a high number. So, your loop
    never gets executed.

    Leave a comment:


  • Billy Scherz
    Guest replied
    Alan,
    Here is the sleeper code, some of the testing I've done indicate there may be a problem in sleeper, when it doesn't have the focus from 23:59:50 to 0:00:00.

    SUB Sleeper (Seconds AS SINGLE) PUBLIC
    csPush "Sleeper"
    DIM t AS SINGLE,NewT AS SINGLE
    'This will wait the exact amount of time, unlike
    IF Seconds! >=0 THEN 'SLEEP which, under a multi-user setting, will
    t!=TIMER 'not work correctly or even consistantly
    NewT! = (t!+Seconds!) MOD %MaxSeconds
    WHILE t! < NewT! AND NOT INSTAT
    CALL ScreenSaver (FALSE)
    t!=TIMER
    WEND
    ELSE
    '? "Pausing...Press A Key To Continue . . ."
    'WHILE INKEY$="" : WEND
    END IF
    csPop "Sleeper"
    END SUB


    ------------------




    [This message has been edited by Billy Scherz (edited April 10, 2000).]

    Leave a comment:


  • Alan Earnshaw
    replied
    What is SLEEPER? It is not part of the PowerBASIC language, so if you can post the code to that routine, we might be able to help you.

    You can take a different approach and use ON TIMER instead:

    Code:
    ON TIMER(10) GOSUB UpdateTime
    TIMER ON
    ' do your program's work here
    TIMER OFF
    END
    
    UpdateTime:
      c.SystemDate = Date2Num(QDATE("U"), "")
      Call DisplayHeader
      RETURN
    Alan


    ------------------
    Alan C. Earnshaw
    Information Management Systems, Inc.

    Leave a comment:


  • Billy Scherz
    Guest started a topic Update display after regaining focus

    Update display after regaining focus

    I have a program that displays current time and date in a header, the display rolls past midnight most of the time. If the DOS box does not have focus when the SLEEPER routine returns between 23:59:50 and 00:00:00 the time and date will not update until a key is pressed. Any other time the time is updated after the focus is regained. This is loop that updates the time.

    DO
    c.SystemDate = Date2Num(QDATE("U"), "")
    Call DisplayHeader
    SLEEPER 10
    Ky$ = UCASE$(INKEY$)
    LOOP WHILE Ky$ = "" or INSTR(ValidKeys$, Ky$) = 0

    TIA
Working...
X