jg@hpldola.HP.COM (Joe Gilray) (01/11/90)
Here is a GEM programming problem: I've written a multiwindow GEM application, everything was fine until I added a "feature" that allows users to edit window data in a dialog box. The dialog box editing function allows the user to edit data that may appear in several windows that are currently open on the screen. Here's the difficulty, when the dialog box closes, the window(s) receive a WM_REDRAW message which is fine, but data may have changed in an area of a window (or two, or three) that is not covered by the dialog box and therefore does not appear on the redraw rectangle list. When the uncovered part of the window(s) is redrawn the window data looks wrong because the part of the window that was not covered is old. Solutions and commentary: 1) When traversing the rectangle list set the clipping area to the whole window instead of the just the covered part, then draw the entire window's data. results: YECH. This doesn't work because the windows are drawn in somewhat random order (any ideas here?) and windows that are beneath other, already drawn windows may pop through them when drawn. 2) When the window(s) are "dirtied" (that is their data is changed), use appl_write() to send a redraw message for the entire desktop. comments: I haven't tried this yet, but it seems pretty good. The questions that come to mind are: a) will this new WM_REDRAW message get merged with the one from the dialog box closure? I know that redraw messages will get merged, I have used this before when I wanted to force a redraw whenever windows were sized (normally window sizing only causes a redraw event if one of the window's dimensions is increased). b) Will this look bad even if the redraws are merged? I'll have to try this and see. 3) Variation on (2) above, send multiple redraw messages, one for each dirtied window. Will these messages all get merged? Anyway, any ideas and comments are appreciated! -Joe Gilray
mui@atari.UUCP (Derek Mui) (01/13/90)
in article <11830069@hpldola.HP.COM>, jg@hpldola.HP.COM (Joe Gilray) says: > > > Here is a GEM programming problem: > > I've written a multiwindow GEM application, everything was fine until I > added a "feature" that allows users to edit window data in a dialog box. > The dialog box editing function allows the user to edit data that may > appear in several windows that are currently open on the screen. > > Here's the difficulty, when the dialog box closes, the window(s) receive > a WM_REDRAW message which is fine, but data may have changed in an area > of a window (or two, or three) that is not covered by the dialog box and > therefore does not appear on the redraw rectangle list. When the uncovered > part of the window(s) is redrawn the window data looks wrong because the > part of the window that was not covered is old. > Here's my $0.02 Inside the same function do the following: Immediately after the dialogue box is closed, do a evnt_multi of Timer Zero and Messages wait. You should receive a redraw message with a rectangle that covered the windows, and then do the normal window redraw. After you have done all these, do your internal data update. Then do a window redraw with a big rectangle ( full desktop size ) to each of the windows. The code should look like: foo( ) { ......; ......; form_do( ... ); form_dial( 3, ... ); event = evnt_multi( MU_TIMER|MU_MESAG, ..., msgbuff, .... ); if ( event & MU_MESAG ) { /* do your own window redraw */ do_redraw( msgbuff[3], &msgbuff[4] ); /* window handle, rectangle */ } update_windowdate( ); /* update your windows' data */ handle = firstwin( ); /* get your first window's handle */ loop { /* rectangle = desktop rectangle area */ do_redraw( handle, rectangle ); handle = nextwin; /* get your next window's handle */ }while( handle >= 0 ); } Hope this helps and works! ================================================================== Derek Mui, Atari Corp, 1196 Borregas Ave, Sunnyvale, CA 94086 UUCP: {..ames!atari!mui} FAX: 408-745-5179 Disclaimer: Opinions expressed here are my own and they may be hazardous to your mind. ==================================================================