[SOLVED] how to close a non modal window

Post

Posted
Rating:
#1 (In Topic #1138)
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
 I am bringing up a non modal window from code. Sometime later I need to close the non modal window from different code. I just can't figure out how to do this. I tried fWindow.close and no go.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
sorry, I solved it myself but here is the answer….
I created a sub to find the window and close it

Code

Sub KillLCarsVisual()
  Dim D As Window

  For Each D In Windows
    If d.Name = "FLCARSVisual" Then
      d.Close
    Endif
  Next
  
End
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
It''l depend on the window creation method to use Close() on the object.

for example

Using
fWindow.Show()
statically to open it should then let you use
fWindow.Close()


But this method for example…

Code (gambas)

  1. Public Sub MakeWin()
  2.  
  3.   Dim hWin As fWindow = New fWindow
  4.   hWin.Show()
  5.  
  6.  
With the above method you will have to use hWin.Close not fWindow.Close but hWin is local to the MakeWin() Function so you would have to use the method you have already come up with.

'

But Then this method should work…

Code (gambas)

  1. Private hWin As fWindow
  2.  
  3. Public Sub MakeWin()
  4.  
  5.   hWin = New fWindow
  6.   hWin.Show()
  7.  
  8.  
  9.  

With the above method hWin.Close should work as hWin is a global variable of the open window
Online now: No Back to the top
1 guest and 0 members have just viewed this.