The paint event is called by the host when it has a paint context ready for painting for that control. This is more direct and efficient than doing the commands and then doing a glpaint. The glpaint is required when you aren't called from within the paint event. I think you are best to paint a control when its paint event handler is called. With multiple isigraphs you probably can't do better than what you have sketched out.

If the multiple isigraphs are contiguous you might be better to have a single control. Then you'd have a single paint event and you could paint each area as required.

----- Original Message ----- From: "Sherlock, Ric" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Thursday, February 07, 2008 8:42 PM
Subject: [Jprogramming] paint event


While trying to create a gl2 version of the GUI for the Set Game
<http://www.jsoftware.com/jwiki/Scripts/Set_Game>, I found that to get
the multiple isigraph controls to smoothly respond to resizing the form,
I had to create a separate paint handler verb for each isigraph control.
I understand that this works because resizing the form will
automatically trigger the verb <formid>_<controlid>_paint for each
control affected if it exists.

I thought I could get around this by using:
setgl2_p0_paint=: 3 : 0
 (i.#H) setpaint"0 1 H
)

setpaint=: 4 : 0
 glsel 'p'&,@": x
 SYMBSZ=: getSymbSz glqwh''
 glclear ''
 drawsymb y
 glpaint ''
)

Where H is and 12 row boxed matrix:
+-----+-----+-------+--------+
|three|blue |shaded |diamond |
+-----+-----+-------+--------+
|three|green|outline|diamond |
+-----+-----+-------+--------+
...
+-----+-----+-------+--------+
|two  |green|solid  |diamond |
+-----+-----+-------+--------+

That is, anytime the setgl2_p0_paint verb was called to update the p0
isigraph control, it would also update all the other isigraph controls
(p1-p11). That doesn't work though and I ended up having to define all
of:
setgl2_p1_paint=:  3 :  '1 setpaint  1{H'
setgl2_p2_paint=:  3 :  '2 setpaint  2{H'
...
setgl2_p11_paint=: 3 : '11 setpaint 11{H'


Is there anyway to simplify this?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm ----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to