Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!bloom-beacon!attunix.att.COM!alecci From: alecci@attunix.att.COM Newsgroups: comp.windows.x Subject: Re: OpenLook: drawing in bulletin boards Message-ID: <9007241400.AA13424@expo.lcs.mit.edu> Date: 24 Jul 90 13:57:00 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 64 > Using the bulletin board widget of Open Look I represent some widgets at > particular coordinates. I want to draw lines or arrows between some of > these widgets. But somehow what is drawn to the bulletin board never > appears at the screen, not even after the bulletin board has been realised. > > Investigation shows that for the bulletin board widget no expose procedure > is defined, which gives an indication why nothing appears. > > Now I have two questions: > > 1. is my line of reasoning okay ? > > 2. maybe somebody knows a workaround ? like a specialization of the > bulletin board that handles expose events ? please comment. > > -------------------------------------------------------------------------------- > Finus van Cadsand, ORIGIN-MW, Eindhoven, the Netherlands > email: finus@ait.philips.nl (will be changed to: finus@ait.origin.nl) right, the bulletin board does not express interest in expose events. The easiest and most straight-forward solution to your problem is to add an event handler (using XtAddEventHandler) to the bulletin board widget that expresses interest in exposures (event_mask set to ExposureMask). Once this is done, your registered routine is called whenever the graphics in the bulletin board needs refreshing. For example: /* ARGSUSED */ static void DrawLines(w, client_data, xevent, continue_to_dispatch) Widget w; /* the bulletin Board's id */ XtPointer client_data; /* your data */ XEvent * xevent; /* real XEvent */ Boolean * continue_to_dispatch; /* ignored */ { .... /* your interesting code */ } /* end of DrawLines() */ .... somewhere in your creation code .... bbw = XtCreateManagedWidget(name, bulletinBoardWidgetClass, parent, args, num_args); XtAddEventHandler(bbw, ExposureMask, False, DrawLines, NULL); Note: If you create and destroy the bulletin board widget often, you may want to remove your added event handler to free any associated memory. For Example: XtRemoveEventHandler(bbw, ExposureMask, False, DrawLines, NULL); XtDestroyWidget(bbw); -o Don P.S. If you were simply doing graphics without adding children to the bulletin board widget, I would have suggested using the Stub Widget instead since it allows a programmer to specify (via a resource) a drawing routine as well as provide exposure compression.