EV_paintOneWindow Function (ROM Call 0xCB)

events.h

short EV_paintOneWindow (void);

Repaints the topmost window.

EV_paintOneWindows searches through a linked list of windows (see wingraph.h header file) for the first window which has WF_DIRTY flag set. If the found window is visible (i.e. if WF_VISIBLE flag is set), the CM_WPAINT message is sent to the application which is the owner of the window (note that WinOpen stores the task ID of the current application in TaskID field of the WINDOW structure). See also notes about EV_sendEvent. After sending this message, WF_DIRTY flag of the window is cleared, and this flag is set in all other windows in the linked list of windows which overlap with this window (because repainting of this window may cause trashing of another windows).

EV_paintOneWindow returns TRUE if the window was "painted" (more precise, if CM_WPAINT message is sent), otherwise it returns FALSE (i.e. if none to paint).

Here is an example which ilustrates that painting of all TIOS windows is "event driven". Suppose that you make very simplified loop which "simulates" normal behaviour of the calculator when it is in the home screen:

while (TRUE)
{
  EV_getc (ACTIVITY_NORMAL, &ev);
  EV_sendEvent (AP_CURRENT, &ev);
}
If you try this program, you will notice that although you can type in statements, execute user programs etc. from this loop, nothing happens on the screen when you type in 2 + 3 <ENTER> (i.e. result 5 is not displayed). This is because the "Home screen" application didn't receive a message which forces redrawing of the Home screen. You can see that everything will be correct if you make the following loop:
while (TRUE)
{
  EV_getc (ACTIVITY_NORMAL, &ev);
  EV_sendEvent (AP_CURRENT, &ev);
  EV_paintOneWindow ();
}


Uses: EV_sendEvent, QScrRectOverlap, FirstWindow
Used by: EV_eventLoop, EV_paintWindows, paint_all_except