Kill a subwindow if it exists
hrodstein
// KillChildWindowIfItExists(windowName, childWindowName)
// Kills a child window of a top-level window if it exists or does nothing if the child does not exist.
// Returns 0 if it killed the child window, -1 if not.
// If you pass "" for windowName it uses the target window.
Function KillChildWindowIfItExists(windowName, childWindowName)
String windowName // Name of a top-level window or "" for top target window
String childWindowName // Name of child window
if (strlen(windowName) == 0)
Variable mask = -1 & ~128 // All window types except for procedure windows
windowName = WinName(0, -1)
endif
String list = ChildWindowList(windowName)
if (WhichListItem(childWindowName,list) < 0)
return -1
endif
String path = windowName + "#" + childWindowName
KillWindow $path
return 0
End
// Kills a child window of a top-level window if it exists or does nothing if the child does not exist.
// Returns 0 if it killed the child window, -1 if not.
// If you pass "" for windowName it uses the target window.
Function KillChildWindowIfItExists(windowName, childWindowName)
String windowName // Name of a top-level window or "" for top target window
String childWindowName // Name of child window
if (strlen(windowName) == 0)
Variable mask = -1 & ~128 // All window types except for procedure windows
windowName = WinName(0, -1)
endif
String list = ChildWindowList(windowName)
if (WhichListItem(childWindowName,list) < 0)
return -1
endif
String path = windowName + "#" + childWindowName
KillWindow $path
return 0
End
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More