Le 30 oct. 06 à 19:46 Soir, Bart Pietercil a écrit:

Hi,

there is definitely something wrong with me, as I don't seem to be able to grasp something that is probably simple:

The problem (for me that is)

I want to switch windows. When I click in Window A on a button I want Window B to open (at the same position and size as Window A) and vice versa.

Should be simple I thought so I wrote this:



  Dim newWindow As Window

  Select Case node.Text -------> using the Einhugur's Taskbar
  case "Beheer Gebruikers"
    newWindow = new studentswindow
    App.SwitchWindow(newWindow)

  case "Beheer Opdrachten"
    newWindow = new KeyFilesWindow
    App.SwitchWindow(newWindow)
  end Select

 App.Switchwindow is this:

 Sub SwitchWindow(ByRef NewWindow As Window)
  Dim myPosInfo As Dictionary


  myPosInfo = new Dictionary

  if App.CurrentWindow isa Window then
    myPosInfo.Value("Left") = App.CurrentWindow.Left
    myPosInfo.Value("Top") = App.CurrentWindow.Top
    myPosInfo.Value("Width") = App.CurrentWindow.Width
    myPosInfo.Value("Height") = App.CurrentWindow.Height


    App.CurrentWindow.Close
    App.CurrentWindow = NewWindow

    App.CurrentWindow.Left = myPosInfo.Value("Left")
    App.CurrentWindow.Top = myPosInfo.Value("Top")
    App.CurrentWindow.Width = myPosInfo.Value("Width")
    App.CurrentWindow.Height = myPosInfo.Value("Height")
  else

    App.CurrentWindow = NewWindow
  end if
End Sub

A dictionnary is not needed here.
I'd do it so:

 Sub SwitchWindow(NewWindow As Window)

  if App.CurrentWindow isa Window then
    NewWindow.Left=app.CurrentWindow.Left
    NewWindow.Top=app.CurrentWindow.Top
    NewWindow.Width=app.CurrentWindow.Width
    NewWindow.Height=app.CurrentWindow.Height

    App.CurrentWindow.Close
    App.CurrentWindow = NewWindow
  else

    App.CurrentWindow = NewWindow
  end if
End Sub

I don't know if that will resolve your crash, but it's simpler (so, simpler to debug)._______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to