Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3886

Prevent Duplicate Window Instance

$
0
0

Hi All,

Since Implicit Instance = Off is all the rage now I thought this would be a good time to ask this question:

Assuming Implicit Instance = Off:
What is the best way to generically create an instance of a window if it is not already in existance and if it is then move said window to the forefront?

Var t As Introspection.TypeInfo
Var strWindowName As String
Var bWindowFound As Boolean

bWindowFound = False

For each w as DesktopWindow in app.Windows
  
  t = Introspection.GetType(w)
  strWindowName = t.Name
  If strWindowName = NewWindowName Then
    bWindowFound = True
  End If
  
Next

I figure that the next bit of code is something like:

If bWindowFound = False Then
// Struggling to figure out what could should be put here so that the requested window is created
// I know that: Var w as New winWindow  will do this, but I think you have to explicitly use the name.  I am trying to figure out how to pass the name and it create the new instance
Else
NewWindownName.Show
End If

Am I making any sort of sense?

Thanks.

20 posts - 7 participants

Read full topic


Viewing all articles
Browse latest Browse all 3886

Trending Articles