How to navigate to a new Form
Posted
#1
(In Topic #328)
Trainee
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?
Posted
Guru

Given multiple different Form objects, how can I swap the currently viewed window between them?
I am not sure I fully understand the question but here is a small program switching between 5 TextAreas. If it's not what you want then let me know.
Posted
Trainee
Thank you!Welcome to the forum
It's a start. I want to have separate "Views" of my application with different purposes (say, a normal usage view + a settings/options view).I am not sure I fully understand the question but here is a small program switching between 5 TextAreas. If it's not what you want then let me know.
In your example you keep all objects into the same Form, hiding all but one of them at any given time. This would achieve my objective, but I was wondering if there was a better way to do it.
In the project I have attached I have two separate forms; I would like to "navigate" (if it makes sense in a Gambas3 context) from the first to the second and return by clicking the buttons.
If this is not possible then my next question would be what is the point of having multiple separate class source files in the same project.
Posted
Administrator

I guess this is what you want to do:
Code for FMain:
Code for FSecond:
You can also use Me.Close on the forms if you like. In code above they stay opened but hidden.
If the idea here is to make some sort of wizard have a look at http://gambaswiki.org/wiki/comp/gb.form/wizard
Enjoy..
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Guru

EDIT. It seems gbWilly had the same idea and beat me to it!
Posted
Trainee
Just one last question. In the example provided by
Posted
Guru

Just one last question. In the example provided bycogier the window changes position when switching from the first to the second Form. I couldn't find the reason behind this behavior in the code, can someone clarify it for me?
'Me' refers to the Form so to position the Form you use 'Me. X' for the horizontal position and 'Me. Y' for the vertical position. As the Form is automatically centered all I had to do was change the 'X' position which is in the code I posted.
1 guest and 0 members have just viewed this.


