0

I am using the latets stable version 6.6.6 64 bit of SWI-Prolog for windows. The code is following:

start :-
    new(Frame, frame('Test')),
    send(Frame, open),
    send(Frame, append, new(Pic, picture)),
    send(Pic, height, 600),
    send(Pic, display, new(_Ref1, text('This will disappear in 3 seconds', center, font(screen, roman, 16)))),
    sleep(3),
    send(Pic, clear),
    sleep(3),
    send(Pic, display, new(_Ref2, text('Good bye!', center, font(screen, roman, 16)))),
    sleep(2),
    send(Pic, clear).

The code does boring staff: It creates a window and a picture canvas on it with height 600px. It displays a text that should disappear in 3 seconds, after 2 secs a new text appears that should disappear in 2 secs.

If I run it without debugging the first text disappears in 8 secs and that's all.

If I run with graphical debugging, the code does what it should (see the code description).

So my worries are for: why there is two different outcomes of the same code and why without debugging the code does not work as it should?

Paulo Moura
  • 18,373
  • 3
  • 23
  • 33
Fibo Kowalsky
  • 1,198
  • 12
  • 23
  • 1
    is it due to 6.6.6 version of the program? ^^ – Fibo Kowalsky Jun 01 '14 at 22:34
  • The difference is caused by lack of refresh of the canvas `Pic`. So, if a cursor is moving over the picture canvas, then the text disappears and appears on it; otherwise the text is not disappeared. Note that a cursor should be moving over the canvas, being over the canvas is not sufficient for the canvas refresh. Quite unexpected behavior of the canvas object. – Fibo Kowalsky Jun 03 '14 at 12:32
  • What is the proper code that will update the canvas itself? – Fibo Kowalsky Jun 03 '14 at 12:33

0 Answers0