Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!mcsun!ukc!tcdcs!bofin!cjmchale From: cjmchale@cs.tcd.ie (Ciaran McHale) Newsgroups: comp.windows.x.motif Subject: Re: XmNexposeCallback -- How do I send my own? Message-ID: <1991Apr29.160040.2850@cs.tcd.ie> Date: 29 Apr 91 16:00:40 GMT References: <1991Apr29.025823.7094@ux1.cso.uiuc.edu> <1991Apr29.040007.11132@dsd.es.com> Distribution: local,world,all Organization: DSG, Dept. of Comp. Sci., Trinity College, Dublin. Lines: 40 In <1991Apr29.040007.11132@dsd.es.com> rthomson@mesa.dsd.es.com (Rich Thomson) writes: >In article <1991Apr29.025823.7094@ux1.cso.uiuc.edu> > CWIKLA@uimrl7.mrl.uiuc.edu (John/Consultant) writes: >> I basically have a drawingarea widget that at some point I need >>the whole thing redrawn. > >Try the following piece of code: > [...] > XtCallCallbacks(da, XmNexposeCallback, (XtPointer) da_struct); > >If some cosmological aligning of the planets prevents this from >working, try: > > XClearArea(XtDisplay(da), XtWindow(da), 0, 0, 0, 0, True); > >This will clear your window and generate an expose event. The first solution >looks more complicated, but is really preferred because it doesn't >actually require a round trip to the server as in the second example. >The round trip happens because you request the clear, then receive the >expose event from the server, while the first doesn't have to wait for >the expose event to arrive before it starts redrawing. Alternatively, >if you neeed the window cleared, but don't want to wait for the expose >event, set the last parameter to False in the XClearArea call (or use >XClearWindow). Another handy way to "send" an event to your own application is to set up the event structure as you would for XSendEvent() but rather than call XSendEvent(), just call XtDispatchEvent() instead. Like above, this avoids the round trip to the server. You can use XClearWindow() or XClearArea(..., False) to clear the window first, if desired. Ciaran. -- Ciaran McHale "I have some faults, but modesty isn't one of them." ---- Department of Computer Science, Trinity College, Dublin 2, Ireland. \ / Telephone: +353-1-772941 ext 1538 FAX: +353-1-772204 \/ Telex: 93782 TCD EI email: cjmchale@cs.tcd.ie