Opening a window fro a menuItem

Maybe a silly question.
I have an app which opens an Introduction window. Here there are 4 buttons each one leading to its specific window.
I could create a button in each window to get back to the Intro one but I thought of putting a menu command in the app menubar to perform this action.
My problem is: how do I detect which of the 4 windows is open so that I can close it and get back to the Intro? The MenuBar is the one of the app and not the one related to the open window

Thank you

try to get the windows list

then check if it is your object

there are two ways to open a window

as single instance

or as much as you want

var w as new Window1

I check if the window exists:

dim FoundWindow as Boolean
for currentWindow as Integer = 0 to App.WindowCount - 1
  dim theWindow as Window = App.Window(currentWindow)
  if theWindow.getWindowName = "PreferencesWindow" then
    FoundWindow = true
  end if

if not FoundWindow then
end if
Public Function getWindowName(Extends theWindow as Window) As String
  'returns the name of a Window
  Dim theTypeInfo as Introspection.TypeInfo = Introspection.GetType(theWindow)
  Return theTypeInfo.Name
  exception exc
    theException = new ErrorException(exc, currentMethodName)
End Function

could be?

if theWindow IsA PreferencesWindow then

somewhere i solved the compare with IsA

1 Like

Sure, why not. There are many ways to do something.

1 Like

I made, thank you. I needed some adjustments but, at least, I had a track to follow.
Thanks again