Displaying directly on Display

Boris Gaertner Boris.Gaertner at gmx.net
Fri Mar 28 19:57:10 UTC 2003


Jon Hylands <jon at huv.com> wrote:


>>Hi everyone,

>>A friend of mine is trying to write an app that will flash something on
the
>>screen for a small number of milliseconds (variable - between say 50 and
>>300 ms).

>>We wrote some code that does it, but with the delay in between displaying
>>this box anything less than about 180 ms, it doesn't actually appear on
the
>>display.

>>The problem is the form doesn't actually show up on the screen at all. Is
>>there some background process that is gathering copyBits calls in the VM
>>and then only updating the screen once in a while?
Yes.
You have several options to enforce immediate display update.
1.In the windows menu, select
   VMPreferences>Display and Sound
  When you see a check mark before "defer display update", you should
  remove it.
   Without that option, all display update will be drawn immediately,
   which is not always what you really want. (It may cause some
   flickering!)

2. With the option "defer display update" set, you can try this:

  |firstForm secondForm |
  firstForm := Form extent: 50 @50 depth: Display depth.
  secondForm := Form extent: 50 @50 depth: Display depth.
  firstForm fillColor: Color red.
  secondForm fillColor: Color green.
firstForm displayOn: Display at: 100 @ 100.
(Delay forMilliseconds: 1000) wait.
secondForm displayOn: Display at: 100 @ 100.
Display forceDisplayUpdate.
(Delay forMilliseconds: 50) wait.
firstForm displayOn: Display at: 100 @ 100

The  "Display forceDisplayUpdate" enforces one immediate refresh
of the screen.

You can do this even more selectively with:
Display forceToScreen: (100 @100 extent: 50 @ 50).


Is this a solution to your problem?

-- Boris






More information about the Squeak-dev mailing list