FxRuby: understanding synthetic events

Hello,

I am new with Ruby and at present try me into simple 2D-graphic.

I have got stuck at the example image.rb [1] of FXRuby now.
There I have an understanding problem:
At the method onCanvasRepaint would be query whether the arriving event
synthetic is. What does this indicate exactly? When is an event synthetic
and when not?

I also would like to ask in the place whether FXRuby and the kind of
operation of the example is well suitable for 2D animations or which
extensions or methods are suitable better.

Thank you in advance.

Ciao
André

[1] http://www.fxruby.org/examples/image.rb

At the method onCanvasRepaint would be query whether the arriving event
synthetic is. What does this indicate exactly? When is an event synthetic
and when not?

A "synthetic" event is one generated by the FOX event loop and not the
operating system's windowing environment. In the image.rb example, the
onCanvasRepaint() method is used to handle SEL_PAINT messages from the
FOX event loop. The first part of that method checks to see if the
event is "synthetic" or not, and, if so, it re-paints the image into
an offscreen buffer (@picture).

If the SEL_PAINT message is synthetic, that means that it was
generated as a result of someone calling update() on the canvas (as is
done, for example, in the onCmdWell() method). For those cases, we
truly do need to update the image in the back-buffer. If the SEL_PAINT
message is *not* synthetic, that means that it was generated due to an
expose event from the windowing system (i.e. part of the window was
covered and then exposed again). If that's the case, we don't need to
change anything in the back-buffer and we simply copy the back-buffer
image to the screen by calling drawImage(@picture).

In other words: Checking whether an event such as SEL_PAINT is
synthetic or not can sometimes help you optimize your program's
response to that event.

I also would like to ask in the place whether FXRuby and the kind of
operation of the example is well suitable for 2D animations or which
extensions or methods are suitable better.

FXRuby is probably as good as any other GUI toolkit for doing 2-D
animations, but that's not really what it was designed for. If you can
be more specific about what kind of application you have in mind that
might help people advise you on other options.

···

On Fri, 22 Oct 2004 23:39:13 +0900, André Pönisch <andre@ap-home.de> wrote:

Lyle Johnson wrote:

André Pönisch wrote:

When is an event synthetic
and when not?

A "synthetic" event is one generated by the FOX event loop and not the
operating system's windowing environment.
[...]

Thanks for the detailed answer.
I already imagined something like that.

Only something confuses me: I have inserted an output in the if-block and
the appropriate else-block as a trial to see if the event synthetic. The
result was that every refresh (also initiated from windowing system) as
synthetic was notified. So every optimization would be senseless in this
direction.
Is this a error between Fox and Windows? I use Windows XP.

FXRuby is probably as good as any other GUI toolkit for doing 2-D
animations, but that's not really what it was designed for. If you can
be more specific about what kind of application you have in mind that
might help people advise you on other options.

I plan nothing special, this are only experiments. I would like only simple
2-D animations to got such as an analogue watch at the moment.

Ciao
André