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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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!news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 08 Apr 2005 15:42:29 -0500 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: graphical output on win xp with gnavi-package References: X-Newsreader: Tom's custom newsreader Message-ID: <4YudnVwju-IoccvfRVn-og@comcast.com> Date: Fri, 08 Apr 2005 15:42:29 -0500 NNTP-Posting-Host: 67.161.24.234 X-Trace: sv3-mkC5NO6Gt1l6YzxUdxGGKdYn19+uOk4I7Ie5t4VILII+0JMyn3BmjnkYC0Zm80K/EHDeDA4eUr6SLR7!KWULFiRIEJDuZkxGJ4O9zNjGgWS7Mnh8LMZG8PL/z1MVbTpq1AXdLh/feguGDQ== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:10352 Date: 2005-04-08T15:42:29-05:00 List-Id: >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".