From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,23b61d4dfe367913 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news2.google.com!proxad.net!newsfeed.stueberl.de!uucp.gnuu.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: graphical output on win xp with gnavi-package Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1f533a5u5ryw7.svvwqn8tb3zu.dlg@40tude.net> Date: Fri, 8 Apr 2005 22:21:13 +0200 Message-ID: NNTP-Posting-Date: 08 Apr 2005 22:21:06 MEST NNTP-Posting-Host: 068636d5.newsread4.arcor-online.net X-Trace: DXC=IV=9a=9[KA]fnCoe<@CEZ^:ejgIfPPldTjW\KbG]kaMXFYk:AnJB[C]L2Z]APlSH1V[6LHn;2LCV^VVa[ZlQni_Qd9HUP?hc\7P X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:10350 Date: 2005-04-08T22:21:06+02:00 List-Id: 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