From: "Daniel P. Zepeda" Date: 2003-01-28T12:53:53+09:00 Subject: Re: [FXRuby] How to force a paint on a canvas. On Tue, 28 Jan 2003 12:47:37 +0900 "Daniel P. Zepeda" wrote: > On Tue, 28 Jan 2003 09:39:36 +0900 > Lyle Johnson wrote: > > > Daniel P. Zepeda wrote: > > > > > Try @outputCanvas.update, although you probably want to reorganize your > > > code and connect it to SEL_MOTION instead of SEL_PAINT. As you are > > > seeing, SEL_PAINT only gets sent when the window has been obscured and is > > > uncovered. Look at scribble.rb in the 'examples' directory of the > > > distribution. > > > > I agree with everything except the idea about tying this to the > > SEL_MOTION message. If you did this, the window would no longer get > > painted in response to normal expose events (i.e. covering the window > > up, and then uncovering it). Furthermore, all of that repainting in > > response to *every* mouse motion over the canvas would be extremely > > inefficient. > > I agree it is not a good idea to connect the code Steve posted to SEL_MOTION. > I didn't make myself clear. I said "reorganize your code and connect it to > SEL_MOTION, look at scribble.rb." What I meant was that if he changed his > code a bit, and connected *the changed code* to SEL_MOTION like is done in > the scribble example, that he could get the effect of seeing the box drawn by > clicking and dragging. I admit I'm not familiar with "turtles", (is that like > the thing that the Logo people did in the 70's, and Dan Kaehler redid for > Smalltalk?) So maybe my suggestion is off the mark. And after re-reading it again, I *still* think I'm not clear enough. I mean *adding code* to a handler for SEL_MOTION, and basically leaving the handler for SEL_PAINT alone. I think maybe I need some sleep, I'm not even making sense to myself! > > > > > Leave the handler code alone, and just add calls to FXCanvas#update > > elsewhere in the program as appropriate, e.g. maybe when the kid adds a > > new action to the list of commands, or in response to clicking a > > "Redraw" button or something. > > > > > -- > "Daniel P. Zepeda" > (Remove commas for address) -- "Daniel P. Zepeda" (Remove commas for address)