Re: graphical output on win xp with gnavi-package



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
.



Relevant Pages

  • Re: GWindows
    ... targeting more than just Windows. ... GNAVI is the open source alternative to visual software development ... fully Open Source under the GPL, the language foundation of GNAVI, ... features to Delphi and Visual Basic including use of Active X ...
    (comp.lang.ada)
  • Re: SourceForge GWindows project
    ... I'm running windows so i'd like to see it on windows :-). ... GWindows for Win32 has already existed for a few years now. ... GNAVI and the framework names GWindows and GNATCOM. ...
    (comp.lang.ada)
  • Re: Windows Ada database support.
    ... > GNAVI, or something else? ... If your application is windows only ... (or doing GUI programming on windows using GNAVI), ... GWindows.Database or ADO bindings directly from GNATCOM are the likely ...
    (comp.lang.ada)
  • Re: Ada suitablity as a game dev language
    ... I have an example of doing direct X programming using Ada with GNAVI at: ... David Botton ... > In windows you may get away with GNATCOM, ...
    (comp.lang.ada)
  • Re: Explorer Exit Redraws Desktop
    ... I'm on a desktop PC with Windows XP Home Edition with Service Pack 2 and ... I've got a perplexing "situation". ... EVERY icon is redrawn when this happens. ... it's annoying and have go so far as to download an alternative ...
    (microsoft.public.windowsxp.general)