[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

FXRuby: Canvas and plotting

parisnight

1/6/2005 11:26:00 PM

I've been trying to use the Canvas widget to plot J1939 data
that is streaming in asynchronously. It seems that the only way to get
a valid drawing context
is after you receive a FX SELECT event. I can use an
FXaddTimeout to trigger an event. The clumsy part about
this approach however is that I have to be responsible for
queuing up all of the data to be plotted in arrays and then
the select method takes the arrays and issues the canvas
plotting methods. This is an inefficient intermediate step
when all I want to do is draw on the canvas.

Is there some way to asynchronously issue Canvas drawing
commands and have FX queue them up outside of a select event?
In other words, is there a way to
get a drawing context that I can simply draw on at any
time without the need for a select? Both tk and xlib
allow me to do this and they take care of queuing the drawing events.
Regards,
Bob

2 Answers

georgesawyer

1/9/2005 12:47:00 AM

0

If you decide ultimately to use FXaddTimeout, I think better not queue the
data in arrays. If the J1939 input (a string?) will stay allocated in
memory, do everything with it after the timeout triggers. If in a
vulnerable system buffer, duplicate its exact form. You're right, I
wouldn't add any clumsy code to hold intermediate data storage formats.
Then move your handling code to the timeout event handler. At worst you
would have a queue of input strings. Just my two cents.

georgesawyer

1/9/2005 1:45:00 AM

0

If you decide ultimately to use FXaddTimeout, I think better not queue the
data in arrays. If the J1939 input (a string?) will stay allocated in
memory, do everything with it after the timeout triggers. If in a
vulnerable system buffer, duplicate its exact form. You're right, I
wouldn't add any clumsy code to hold intermediate data storage formats.
Then move your handling code to the timeout event handler. At worst you
would have a queue of input strings. Just my two cents.