Page 1 of 1

A forms close 'X' in the top right hand corner.

Posted: Monday 31st May 2021 8:22pm
by Ade
I'm new to GamBas and loving it as it brings back memories of using Basic on my old BBC Micro computer. Now using Linux, I am Starting to learn about the controls and events in GamBas.

Can somebody help me. I have 2 forms open on screen (eg Form1 and Form2), if Form 2 is closed using the 'X' in the top right hand corner, how can Form1 detect this when it happens ?.

Thanks in advance for any help you can give.

Re: A forms close 'X' in the top right hand corner.

Posted: Monday 31st May 2021 11:26pm
by BruceSteers
Form2 has an event.
Public Sub Form_Close()

That is triggered when the close window is called


You can make a 'public' function in Form1...

Public Sub Form2Closed()

End

And in Form2 write.

Public Sub Form_Close()
Form1.Form2Closed()
End

Re: A forms close 'X' in the top right hand corner.

Posted: Tuesday 1st June 2021 10:21am
by cogier
If you are happy to have the 1st Form wait until 2nd Form is closed you can open the 2nd Form with:-
Form2.ShowModal


The next command in the 1st Form will not be processed until the 2nd Form is closed.

Re: A forms close 'X' in the top right hand corner.

Posted: Wednesday 2nd June 2021 8:58am
by Ade
Thanks guys, tried both methods and it all work a treat. Great. :D