Re: XForms: drawing a line in fl_add_free from a data file

Stephen Langer (langer@cam.nist.gov)
Thu, 21 Aug 1997 09:17:10 -0400

To subscribers of the xforms list from "Stephen Langer" <langer@cam.nist.gov> :

> To subscribers of the xforms list from Raoul Beauduin
<beauduin@ori.u-tokyo.ac.jp> :
>
> > > Looks as if XForms has lost track of the object's Window for one
> > > reason or another. You might try calling
> > >
> > > fl_winset( FL_ObjWin( free_object ) );
> > >
> > > to make sure you're pointing to the right place.
> >
> > Thank you. It worked. But an other problem occured.
> > I am using Fvwm2 as window manager. Every time i change of screen and
> > come back, the lines i have drawn in fl_add_free have all disappeared.
> > How can I make them stick to the free object?
>
> Oups! correction! When I change of desktop, the lines are deleted.
> Inside a desktop, moving from one screen to another and then back to
> where the application is, does not delete the lines.
> Any explanation?
>

What happens when you cover up the window with another window, then
expose it? The lines probably don't show up.
It sounds as if you're not handling the FL_DRAW events properly in
the free object handler. I'd guess you're trying to do something
like this:

FILE *file = fl_show_fselector(...);
while(readline_from_file(file, line))
draw(line);

whereas what you should do is something like this:

FILE *file = get_file_from_fselector();
while(readline_from_file(file, &line))
store_line(line);
fl_redraw_object(freeobject);

and in the free object handler:

switch(event) {
case FL_DRAW:
draw_stored_lines();
break;
....
}

Then you don't need to call fl_winset(), since XForms knows that you're
drawing in the free object when it calls the free object handler. Also,
you've saved the information about how to redraw the window after it's
been hidden by another window.

-- Steve

-- 
-- EMail: stephen.langer@nist.gov                    Phone: (301) 975-5423 --
-- WWW:  http://math.nist.gov/mcsd/Staff/SLanger/    Fax:   (301) 990-4127 --
-- Mail: Building 820 Room 365; NIST; Gaithersburg, Md          20899-0001 --
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/