Re: XForms: Free object draw and redraw problem

Lam Chin Hun Ricky (chlam@mae.cuhk.edu.hk)
Mon, 4 May 1998 19:01:14 +0800 (HKT)

# To subscribers of the xforms list from Lam Chin Hun Ricky <chlam@mae.cuhk.edu.hk> :

> The answer to this question, of course, depends upon your system and
> the connection to your server but if your Free object handler is
> completing its work and returning within that period of time then you
> should be getting updates.
>
> Are you by any chance modifying any other objects from within your
> Free object handler? This can confuse XForms. If you need to update
> other objects, this should be done from a callback, not an object
> handler. I don't see this as the source of this problem but it's
> worth a look.
>
> Just as an experiment, you might try calling
>
> XFlush( fl_get_display() );
>
> at the end of your drawing, just to see if that makes a difference.
> (It really shouldn't if you're calling fl_check_forms() after calling
> fl_redraw_object() but who knows.)
>
> Do I understand correctly that the initial graphics in your Free
> object are drawn and then nothing else ever gets updated, no matter
> how long you wait? Or are things being updated but not at the pace at
> which you'd expect?
>
> Without seeing the handler code that's probably about all I can suggest.
>
> spl

Hi,

Here is part of the program :

int freeobj1_handle(FL_OBJECT *ob, int ev, FL_Coord mx, FL_Coord my,
int key, void *xev)
{
int i;
float d, alpha, x, y, x1, x2, y1, y2;
alpha=(M_PI*3.5)/180;
fl_ovalf(515,150,40,40,FL_TOMATO);
fl_ovall(513,148,44,44,FL_BLACK);
for (i=0;i<25;i++)
{
d=value/75;
if(d<10500)
{
x=535+22*sin(Angle(0,i)+M_PI);
y=170+22*cos(Angle(0,i)+M_PI);
x1=535+d*sin(Angle(0,i)+alpha+M_PI);
y1=170+d*cos(Angle(0,i)+alpha+M_PI);
x2=535+d*sin(Angle(0,i)-alpha+M_PI);
y2=170+d*cos(Angle(0,i)-alpha+M_PI);
fl_line(x,y,x1,y1,FL_BLACK);
fl_line(x,y,x2,y2,FL_BLACK);
fl_line(x1,y1,x2,y2,FL_BLACK);
XFlush( fl_get_display() );
}
}
return 0;
}

The function is to draw a filled circle, a line circle and three lines within the area of the free object (location is 395,30,280,280). All the lines will change their lengths according to the data defined by the following routine.

void length()
{
(get the new data);
fl_redraw_object(fr);
}

This routine is called when there are new data arrived. It gets the new data and call fl_redraw_object() and the rate is really fast (more than 3 times per sec). fr is the pointer pointing to the free object.

Other objects like buttons and sliders just handed and not response when running. The free object is updated but overlap with the old one. Can somebody tell me why?

Thanks in advance!

Regards,

Ricky
_________________________________________________
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/