comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: graphical output on win xp with gnavi-package
Date: Fri, 08 Apr 2005 15:42:29 -0500
Date: 2005-04-08T15:42:29-05:00	[thread overview]
Message-ID: <4YudnVwju-IoccvfRVn-og@comcast.com> (raw)
In-Reply-To: e499e546.0504081047.5cd5c390@posting.google.com

>I am very new with ada-graphic programming and with windows graphics
>...
>What causes windows to delete my window and how can i use wm_paint to
>get my nice background picture back?

  Under Windows, your program is not generally in active control - it is
instead a set of passive responders to user initiated events, clicks,
keys, sliding windows over other windows, etc.  So your drawing needs to
happen when Windows asks for it, for instance when the on-screen window
has just been uncovered.  The computation/database/whatever part of the
program will set up a data structure, and the drawing routine will, at
random times determined by the user, glance at that data and draw
appropriately.  Think of your drawing routine as being an Interrupt
Service Routine.

  Windows doesn't actually use interrupts, however.  What it does is put
"events" into a queue and your program needs to constantly run a polling
loop to see if there are any events in the queue and respond
appropriately.  If the "window needs to be redrawn" event (WM_PAINT) is
queued, then the polling loop needs to call your drawing routine.  Part of
the "event" record from the queue is the information needed by the drawing
routine to know which window needs repainting.  In Claw, the polling loop
is run automatically as a separate task.  Windows are tagged records with
a "procedure When_Draw(Window,...)" as a primitive operation.  You declare
your own "type My_Window_Type is new Window_Type with ..."  and your own
overiding When_Draw.  When the Claw message loop sees a WM_PAINT event, it
calls When_Draw, dispatching on the particular window, and thus your
When_Draw routine for that window is called.

  If your program decides on its own that the window should be repainted
(the data on which it is based has changed, say), it can make an OS call
to "invalidate" the window, which will result in a WM_PAINT being fed to
the message loop, and thus your drawing routine being called.

  You might want to look at our Tri-Ada paper "CLAW, a High Level,
Portable, Ada 95 Binding for Microsoft Windows", which is available
online at www.rrsoftware.com/html/prodinf/triadapaper/triada.html
in particular section 3.1 "Mapping Windows Organization to CLAW".



  parent reply	other threads:[~2005-04-08 20:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-07 15:45 graphical output on win xp with gnavi-package Duke Luke
2005-04-07 23:32 ` Randy Brukardt
2005-04-08 13:57   ` Duke Luke
2005-04-08 18:33     ` Randy Brukardt
2005-04-08 14:52 ` Dmitry A. Kazakov
2005-04-08 18:47   ` Duke Luke
2005-04-08 20:21     ` Dmitry A. Kazakov
2005-04-08 20:41     ` Gautier Write-only
2005-04-08 20:42     ` tmoran [this message]
2005-04-09 11:51       ` Duke Luke
2005-04-09 18:30         ` tmoran
2005-04-11  5:37           ` Duke Luke
2005-04-12 16:18           ` Duke Luke
2005-04-12 17:24             ` tmoran
2005-04-13 15:19               ` Duke Luke
2005-04-13 18:16                 ` tmoran
2005-04-14  6:24                   ` Duke Luke
2005-04-14 17:54                     ` tmoran
2005-04-15 10:04 ` Duke Luke
2005-04-15 17:56   ` tmoran
2005-04-16  9:58     ` Duke Luke
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox