Search code examples
user-interfacegambas

How to navigate to a new page in Gambas3


I find myself having to deal with some delightful legacy software written in Gambas3. I have to extend the functionality of a small GUI application with a new control page.

Naturally, as for similar GUI libraries I've worked with (web, Android development, flutter, ...) I came looking for a way to navigate between different pages. It is almost implied as possible by the organization in .form files.

Unfortunately, I couldn't find a way to achieve this. Given multiple different Form objects, how can I swap the currently viewed window between them?


Solution

  • Thanks to the uses of the Gambas ONE forum I now have the answer.

    To achieve a "form switch" one must hide/close the first form and show the next:

    Public Sub Next_Click()
    
      FSecond.Show
      Me.Hide
    
    End
    
    Public Sub Return_Click()
    
      FMain.Show
      Me.Hide
    
    End
    

    Hiding the form will just make it disappear from view, closing it will destroy it (and following calls to Show will create it again).