comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: graphical output on win xp with gnavi-package
Date: Fri, 8 Apr 2005 22:21:13 +0200
Date: 2005-04-08T22:21:06+02:00	[thread overview]
Message-ID: <t91laro6bnt6.pvsosia5txoy$.dlg@40tude.net> (raw)
In-Reply-To: e499e546.0504081047.5cd5c390@posting.google.com

On 8 Apr 2005 11:47:31 -0700, Duke Luke wrote:

> Can you explain that a little further?

Ooch! (:-))

> I am very new with ada-graphic programming and with windows graphics
> (though I'm quite good with ada itself).
> If you have no experience with gnavi, it would sure help me, too, if
> you explain it on a more general level.

It is really difficult to do because I don't know the architecture of
gnavi...

> What causes windows to delete my window and how can i use wm_paint to
> get my nice background picture back?

Windows GUI is messages-oriented. There is at least one messages loop in
each Windows graphical application that handles various messages generated
by various events. The messages loop is also sort of distributed across the
parent-child window hierarchy (that has the effect that some messages might
get swallowed/processed somewhere beneath.)

So a windows GUI application has:

function Windows_Proc
         (  Window  : HWND;
            Message : UINT;
            WPar    : WPARAM;
            LPar    : LPARAM
         )  return BOOL is
begin
   case Message is
      when WM_CLOSE =>
      when WM_PAINT =>     
      when WM_COMMAND =>
         case HIWORD (DWORD (WPar)) is
            when BN_CLICKED =>
               case LOWORD (DWORD (WPar)) is
                  when Some_Button =>
                  when others =>
               end case;
            when others =>
               null;
         end case;
      when WM_INITDIALOG =>
      when others =>
   end case;
   return 0;
end Window_Proc;

Now it all depends on the GUI tool you are using. Some of them, like GTK,
OpenGL hide this mechanics and process all messages internally.

Anyway, when Windows detects that a portion of a window need to be redrawn
it sends series of messages to the window. There are many of them sent to
redraw the window frame, the background, and among them WM_PAINT is sent to
notify (you!) that the client area should be redrawn. Now, depending on
which windows procedure yours augments (remember windows hierarchy?) some
of these messages will be handled (like WM_ERASEBKGND, which causes erasing
the background in your case) some of them will need handling like WM_PAINT.
There could be two reasons why WM_PAINT is not handled by gnavi:

1. gnavi doesn't do it;

2. You did something wrong that prevents gnavi from reacting to WM_PAINT.

If it is really the case 1 (is it?) then you need to identify your window
procedure or its equivalent: gnavi might be able to perform some callback
upon WM_PAINT if you tell it that you need it. From that place do what you
did to paint the window for the first time.

Note that if the window permanently changes its state and need to be
redrawn anyway, then do as the most games do, draw the window from a task,
ignoring WM_PAINT (and also suppress WM_ERASEBKGND.)

-------------
How Windows works is described in MSDN:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pantdraw_01id.asp

But be prepared, if you are among those who think that ARM is hard to
understand, then it is like nursery rhymes compared with MSDN! (:-))

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-04-08 20:21 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 [this message]
2005-04-08 20:41     ` Gautier Write-only
2005-04-08 20:42     ` tmoran
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