Graph in a panel

I have a problem with the last version of Igor (6.22)
I wrote the following code fot the versione 6.12 and it works
It creates a new panel (panel2) embeded in a existing panel (panel1) and then it dispays a graph in the new panel

Newpanel/EXT=1/HOST=panel1/N=panel2/W =(500,30,20,325)
Display/HOST=panel2/W=(10,10,480,280) $wave

With the versione 6.22 it doen't work, I can manage only by creating the new panel not embeded in old one.

Any hits???
Thanks

Simone
Panel2 isn't a top-level window. It is a logical subwindow of Panel1 (the host window).
Use Panel1#Panel2 to refer to the exterior panel, as in this example:
Macro  test()
    DoWindow/K Panel1
    DoWindow/K Panel2

    NewPanel/N=Panel1
    NewPanel/EXT=1/HOST=Panel1/N=Panel2/W =(500,30,20,325)
    Make/O data=x
    String wave="data"
    Display/HOST=Panel1#Panel2/W=(10,10,480,280) $wave
End


Also, I'd recommend against using a command like 'String wave = "data"'.

Wave is a keyword with so many other meanings you'd be better off using String wavesName="data", instead.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
I have a related problem to this procedure.
I wrote the code in a way in which I can display different graphs on the panel 2. The problem is that new graph is dislay on the old ones in a new subwindow
I would like to display only one graph (deleting the previuos one), any suggestion?
In any case how can call the different graph?
panel1#panel2#G0
panel1#panel2#G1
ect?
There are a couple of ways to do this.

If you are making the wave each time you replace the graph, just overwrite the wave each time. You might do something like
Function MakeMyGraph()

    Make/O data
    // some sort of analysis fills in the data in the wave "data"
    data = x        // stand-in for analysis
   
    if (WinType("panel2") != 7)
        Newpanel/N=panel2/W =(100,100,700,500)
        Display/HOST=panel2/W=(10,10,480,280) data
    endif
end

This code makes the wave called "data" and does something to it. Then, if the panel called "panel2" does not exist, it makes the panel and the embedded graph. If the panel already exists (and, we assume, the graph) it skips the step of making the panel and graph. But the wave has been replaced with a new version of the wave with new contents, and the graph will update to reflect that fact.

This code is for illustration; I would separate the analysis part from the panel-making part by writing two functions. Then the function that makes the graph can call the analysis function. I find that I virtually always need to call the analysis part separately at some point in the evolution of the code.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks John for the suggestion.
I have other questions
Can I use the cursors on a graph embeded in a panel??
I try to write the command
Showinfo /panel1#panel2 but it doesn't works....
simcacl wrote:
Can I use the cursors on a graph embeded in a panel??
I try to write the command
Showinfo /panel1#panel2 but it doesn't works....

You can, but you need to look up the syntax of the ShowInfo command. Use this instead:
ShowInfo/W=panel1
Info panels go with windows, not subwindow. They then adjust themselves to the active subwindow.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
So I have this situation

Newpanel /N=Panel1
NewPnale/Host=panel1 N=panel2
Display/Host=panel1#panel2 $data

I can't use the cursors in the graph on panel2???
Sure you can use cursors in the graph subwindow. Just click it to make it the active subwindow and then choose Show Info from the Panel Menu.