Below is a simple toy program I am using to experiment
with J windows, as an example of what I am doing:
NB.
----------------------------------------------------------------------------
NB. Graphics test
NB.
----------------------------------------------------------------------------
require 'gl2'
coinsert 'jgl2'
WINDOW =: 0 : 0
pc Window;
menupop "File";
menu exit "&Exit";
menupopz;
menupop "Options";
menu redraw "&Redraw";
menupopz;
)
Window_close =: 3 : 0
wd 'timer 0; pclose'
)
Window_cancel_button =: 3 : 0
Window_close ''
)
Window_exit_button =: 3 : 0
Window_close ''
)
Window_redraw_button =: 3 : 0
wd 'psel Window; setinvalid display'
)
Window_display_paint =: 3 : 0
glclear ''
'rows cols' =. glqwh '' NB. size in pixels
glrgb 0 0 0
glbrush ''
glrect 0 0, cols, rows
for_row. i. rows do.
for_col. i. cols do.
c =. j./ OFFSET + SCALE * col, row
z =. 0j0
for_n. i. 256 do.
if. 2 < | z do.
glrgb ((# PALETTE) | 20 * n) { PALETTE
glpixel row,col
break.
else.
z =. c + z * z
end.
end.
end.
wd 'pshow;'
end.
)
NB.
----------------------------------------------------------------------------
NB. run - Main Program
NB.
----------------------------------------------------------------------------
run =: 3 : 0
BORDER =: 5
scrsize =. 4 8 * %/ 2 2 $ 0 ". wd 'qm;' NB. --- Screen size in xywh
units
size =. <. 0.80 * <./ scrsize
PALETTE =: |. 0 0 1 {"1 ] 0 ,. i. 256
SCALE =: 0.004
OFFSET =: -2
wd WINDOW
wd 'xywh ',(": BORDER, BORDER, size, size),';cc display isigraph
rightmove bottommove;'
wd 'pas ',(": 2 # BORDER),'; pshow;'
)
NB.
----------------------------------------------------------------------------
NB. Autostart on load
run ''
I don't know whether J lets you intercept operating system messages, but if
it does, (and you're running on Windows) you could watch for the
WM_ENTERSIZEMOVE message and ignore all WM_SIZE messages until you see
WM_EXITSIZEMOVE.
David Liebtag
I tried your example and it was hanging forever until I changed the
size in run to
size =: <. 0.80 * <./ scrsize
size=:size%10
I suspect you will get a better response to questions like this on the
J programming forum.
http://www.jsoftware.com/jwiki/System/Forums
Will wd 'qformx' be of use?
The Window_display_paint verb is very slow/processor intensive. Have
you thought about creating the pixel array first and then using
glpixels or glpixelsx to update the isigraph control?
Is the following link of interest?
http://rosettacode.org/wiki/Mandelbrot_set#J