Nobody's answered you yet, Andrew...!

I was hoping someone who knows would, because I too have run into the
problem. And I haven't had time to look into it properly yet.

But it seems that 'plot' (unlike 'viewmat') has a sneaky technique to
avoid successive 'plot'-calls creating new windows. Instead the
existing window is painted with a new picture.

This militates against its use as a class which you can instantiate to
make several independent windows in the way you're trying to do. Even
though plot.ijs itself instantiates jzplot to make jwplot: the working
locale.

But see how it does it...

Look at pclose, for instance -- the handler that gets run when you
close the plot window. It expects to find the window handle in a
global: PFormhwnd --which resides in the class-locale: jzplot --as
does pclose itself. So there is only one window handle, which points
to the last plot-window opened.

In contrast, a "proper" JWD class-instance, eg of locale jijs, owns
its own independent window, and has its own handle SMHWNDP to find it.
To see this, create a new IJS window with Ctrl-N, cocurrent the
numbered locale just created (=the highest number) and inspect its
contents. There's hardly anything in it *but* SMHWNDP (plus the stuff
to show in that window).

I guessed I was going to have to hack jzplot to bend it to my will.
Namely, to permit several independent copies of the plot window. The
IJS window shows the way, with its numbered locale.

Best of luck if you want to go down that route. In a month or so, when
I get round to it, I'll let you know how I got on, if you're still
keen to know.


On Thu, May 12, 2011 at 1:55 PM, Andrew Nikitin <[email protected]> wrote:
>
> When I do this in J601:
>
>   load 'plot'
>   P0=:conew 'jzplot'
>   P1=:conew 'jzplot'
>   plot__P0 i.20
>   plot__P1 *:i.20
>   plot %:i.20
>
> I get 3 plot windows (some of them are on top of each other, have to
> move around to see).
> Then if I try to close the %:i.20 window either by clicking on X in its
> top right corner, or by keyboard shortcut alt+F4, it closes i.20 window
> first, then *:i.20 window next and only then it closes the window I
> asked to close.
> I do not see anything obviously wrong with pclose_jzplot_, where is
> the catch?
>
> ----------------------------------------------------------------------
> 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