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 »

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: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

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

Post 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
Last edited by BruceSteers on Tuesday 1st June 2021 11:14am, edited 1 time in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1118
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 »

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 »

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