List Objects where a wave is shown

Hello everyone, i have a simple question. Is it possible to get a List of all Windows, where a specific wave is shown? The DataBrowser has this feature by performing a right-click on a wave and selecting "Show where Object is used ..", but i wasn't able to find a Igor-function that is giving me that list from the program language. I know that there is the option to use "CheckDisplayed" for every window, but this seems to be quite awkward. Best regards, Flashbanger
Hi, The operation checkdisplayed will check to see if a wave is displayed and you can use a flag with a specific window so you can go through all open windows to build a list. I would build this once as a function in general form. I bit of a pain but then you have it. CheckDisplayed [/A/W=winName ] waveName [, waveName ]... The CheckDisplayed operation determines if named waves are displayed in a host window or subwindow. Flags /A Checks all graphs and table windows. /W=winName Checks only the named graph or table window. When identifying a subwindow with winName, see Subwindow Syntax for details on forming the window hierarchy. Andy
I had written some code to do this before that feature was available in the DataBrowser:
// Start with data browser open, and wave selected in data browser. (Could of course use CreateBrowser to do this too.)
// Selected wave in the data browser can be in any datafolder (doesn't have to be current datafolder).
macro FindSelectedWave()
    FindWindowContainingSelWave()
end

function FindWindowContainingSelWave()
    string fullSelection, wToFind, windowList, windowName, DFpath, savedDataFolder, foundWindows
    variable n, num

    if(DataFolderExists(GetBrowserSelection(0)))
        Abort "Please click on a wave, not a datafolder."
    endif
   
    savedDataFolder = GetDataFolder(1)          //current data folder
    fullSelection = GetBrowserSelection(0)      //wave selected
    wToFind = ParseFilePath(0, fullSelection, ":", 1, 0)        //get the wave name only (removes datafolders if any)
    DFpath = ParseFilePath(1, fullSelection, ":", 1, 0)     //get datafolder path to that wave
    SetDataFolder DFpath                                    //set datafolder to the one containing the selected wave
   
    Print "Searching for wave ",fullSelection
   
    foundWindows = ""                                       //init
    windowList = WinList("*", ";","WIN:3")              //list of all tables and graphs
    num = ItemsInList(windowList)                      
    for(n=0; n<num; n+=1)                               //loop thru them all to find which one has wave in use
        windowName = StringFromList(n, windowList)      //get a window name

        if (strlen(wavelist(wToFind, ";", "WIN:"+windowName))>0)    //if the wavelist command returns a string, this window has the wave in it.
            foundWindows+= windowName+";"
        endif
    endfor
   
    if (strlen(foundWindows)==0)                                        //if loop index has incremented to num, then wave wasn't found in any graph or table.
        Print "Wave ",wToFind, "is not in use."
    else
        Print "Wave is used in window(s) ", foundWindows
        DoWindow/F $(StringFromList(0, foundWindows))   // bring first window containing wave to front, but could do them all in loop
    endif
   
    SetDataFolder savedDataFolder                       //set datafolder back to original setting.
end
Hope this helps Ken