Lisp HUG Maillist Archive

Problems with animated pinboard objects

Hi everybody,

I've just hacked together a little demo app for my students to
demonstrate the well-known "Towers of Hanoi" problem.  I have a
couple of questions, though:

The program uses a pinboard layout for the main window and the
disks are pinboard objects which are drawn using two calls to
DRAW-RECTANGLE - one for the golden color, one for the black
outline.  To move a disk, I update its position using (SETF
PINBOARD-PANE-POSITION) and then call REDRAW-PINBOARD-OBJECT.
This is more or less based on the "balloons" example that comes
with LW except that I use a separate process where the example
uses a timer.

Question 1: This works if done from a separate process via
APPLY-IN-PANE-PROCESS as described above.  If, however, I
manipulate and redraw the pinboard objects directly from the
interface's process, the pinboard layout is never updated.  Why
is that?

Question 2: I'm on Windows 7 and I usually use a "classic"
desktop theme.  The whole animation looks fine like this.  But if
I instead switch to one of the "Aero" themes, the moving pinboard
objects are only partially drawn and the animation looks ugly.
Any explanation for that?  (I've tried buffered and unbuffered
drawing as well the new "quality" mode vs. the old compatible
mode, but none of this seems to make a difference.)

Question 3: The same app builds fine on Linux (with GTK) and Mac
OS as well, but the outcome is a disaster.  This is not so
important to me, but nevertheless I'd be happy to know where in
my code I'm making Windows-specific assumptions.

The apps for Windows and Linux can be downloaded from
<http://weitz.de/files/Hanoi.zip> and
<http://weitz.de/files/hanoi.tar.gz> if you're interested.  If
you have an idea what the problem might be and want to see the
source code, please drop me an email.

Thanks for your help,
Edi.

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: Problems with animated pinboard objects

Unable to parse email body. Email id is 11804

RE: Problems with animated pinboard objects

Hi Edi,

Tried the app on my Win XP box and I don't see any of the issues you describe there. Off the top of my head, and without seeing your code, I'd make two suggestions:



1. I had some redisplay problems with (SETF PINBOARD-PANE-POSITION), which went away when I switched to SET-HINT-TABLE.
2. This might be something due to the fact that WM_PAINT messages are of low priority, and so can get delayed in the message queue. I removed some quite serious redisplay glitches when I introduced calls to UpdateWindow at selected points in my low-level drawing routines. This function causes the WM_PAINT message to be sent immediately, bypassing the message queue.


(fli:define-c-typedef hwnd (:unsigned :long))


(fli:define-foreign-function (update-window "UpdateWindow")
  ((hwnd hwnd))
  :result-type :boolean)


I don't use Windows 7, however, so apologies if these suggestions are way-off.


Best,
Chris

> From: edi@agharta.de
> Date: Wed, 14 Nov 2012 13:28:54 +0100
> Subject: Problems with animated pinboard objects
> To: lisp-hug@lispworks.com
>
>
> Hi everybody,
>
> I've just hacked together a little demo app for my students to
> demonstrate the well-known "Towers of Hanoi" problem. I have a
> couple of questions, though:
>
> The program uses a pinboard layout for the main window and the
> disks are pinboard objects which are drawn using two calls to
> DRAW-RECTANGLE - one for the golden color, one for the black
> outline. To move a disk, I update its position using (SETF
> PINBOARD-PANE-POSITION) and then call REDRAW-PINBOARD-OBJECT.
> This is more or less based on the "balloons" example that comes
> with LW except that I use a separate process where the example
> uses a timer.
>
> Question 1: This works if done from a separate process via
> APPLY-IN-PANE-PROCESS as described above. If, however, I
> manipulate and redraw the pinboard objects directly from the
> interface's process, the pinboard layout is never updated. Why
> is that?
>
> Question 2: I'm on Windows 7 and I usually use a "classic"
> desktop theme. The whole animation looks fine like this. But if
> I instead switch to one of the "Aero" themes, the moving pinboard
> objects are only partially drawn and the animation looks ugly.
> Any explanation for that? (I've tried buffered and unbuffered
> drawing as well the new "quality" mode vs. the old compatible
> mode, but none of this seems to make a difference.)
>
> Question 3: The same app builds fine on Linux (with GTK) and Mac
> OS as well, but the outcome is a disaster. This is not so
> important to me, but nevertheless I'd be happy to know where in
> my code I'm making Windows-specific assumptions.
>
> The apps for Windows and Linux can be downloaded from
> <http://weitz.de/files/Hanoi.zip> and
> <http://weitz.de/files/hanoi.tar.gz> if you're interested. If
> you have an idea what the problem might be and want to see the
> source code, please drop me an email.
>
> Thanks for your help,
> Edi.
>
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html
>

Re: Problems with animated pinboard objects

It seems I was able to fix the issues I mentioned below.  In case
you're interested, you can download the program (Windows, Mac OS,
Linux) here: <http://weitz.de/hanoi/>.  Please let me know if you
encounter any problems.

Christopher, thanks for your suggestion.  It didn't help in this case,
but I'll keep it in mind for the future.

Cheers,
Edi.


On Wed, Nov 14, 2012 at 1:28 PM, Edi Weitz <edi@agharta.de> wrote:
> Hi everybody,
>
> I've just hacked together a little demo app for my students to
> demonstrate the well-known "Towers of Hanoi" problem.  I have a
> couple of questions, though:
>
> The program uses a pinboard layout for the main window and the
> disks are pinboard objects which are drawn using two calls to
> DRAW-RECTANGLE - one for the golden color, one for the black
> outline.  To move a disk, I update its position using (SETF
> PINBOARD-PANE-POSITION) and then call REDRAW-PINBOARD-OBJECT.
> This is more or less based on the "balloons" example that comes
> with LW except that I use a separate process where the example
> uses a timer.
>
> Question 1: This works if done from a separate process via
> APPLY-IN-PANE-PROCESS as described above.  If, however, I
> manipulate and redraw the pinboard objects directly from the
> interface's process, the pinboard layout is never updated.  Why
> is that?
>
> Question 2: I'm on Windows 7 and I usually use a "classic"
> desktop theme.  The whole animation looks fine like this.  But if
> I instead switch to one of the "Aero" themes, the moving pinboard
> objects are only partially drawn and the animation looks ugly.
> Any explanation for that?  (I've tried buffered and unbuffered
> drawing as well the new "quality" mode vs. the old compatible
> mode, but none of this seems to make a difference.)
>
> Question 3: The same app builds fine on Linux (with GTK) and Mac
> OS as well, but the outcome is a disaster.  This is not so
> important to me, but nevertheless I'd be happy to know where in
> my code I'm making Windows-specific assumptions.
>
> The apps for Windows and Linux can be downloaded from
> <http://weitz.de/files/Hanoi.zip> and
> <http://weitz.de/files/hanoi.tar.gz> if you're interested.  If
> you have an idea what the problem might be and want to see the
> source code, please drop me an email.
>
> Thanks for your help,
> Edi.

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:36 UTC