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

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
User avatar
Ade
Posts: 2
Joined: Wednesday 26th May 2021 3:41pm

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

Post by Ade » Monday 31st May 2021 8:22pm

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.

User avatar
BruceSteers
Posts: 654
Joined: Thursday 23rd July 2020 5:20pm

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

Post by BruceSteers » Monday 31st May 2021 11:26pm

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
Last edited by BruceSteers on Tuesday 01st June 2021 11:14am, edited 1 time in total.
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
cogier
Site Admin
Posts: 756
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

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

Post by cogier » Tuesday 01st June 2021 10:21am

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.

User avatar
Ade
Posts: 2
Joined: Wednesday 26th May 2021 3:41pm

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

Post by Ade » Wednesday 02nd June 2021 8:58am

Thanks guys, tried both methods and it all work a treat. Great. :D

Post Reply