[Gambas-user] "Me.Persistent = True" does not work?

Bruce Steers bsteers4 at gmail.com
Mon Jan 10 14:55:53 CET 2022

On Mon, 10 Jan 2022 at 13:47, Gianluigi <bagonergi at gmail.com> wrote:

> Il giorno lun 10 gen 2022 alle ore 13:42 Cristiano Guadagnino <
> criguada at gmail.com> ha scritto:
>> Hi,
>> I am using the statement in the subject line in the FMain.Open() handler
>> (where FMain is the main window of my app).
>> By using that statement, I had hoped to be able to hide the main window
>> instead of closing it when a user clicks on the "X" button in the titlebar.
>> That's what I understood reading the docs.
>> And I am mostly sure it DID work in the past.
>> But now, if I click on the "X" button my app is closed instead.
>> Is it a bug?
>> I am using Gambas 3.16.3.
>> Best regards
>> Cris
That's not what Persistent meant.

If your app only has one window and yo uhit the close button then it should
close. that is not a bug.

A Persistent window would be like a settings window, that opens and closes
while your main app is active.

The difference (as i understand) between a persistent window and non
persistent is that when opening and closing the persistent window it's
contents are made fresh or destroyed each time.
A persistant window will not forget it's contents when closing/opening.

If before you could press the close button but the app did not quit then
that was a bug in your app.

To Catch and stop a window close you should do this..

Public Sub Form_Close()

  If bDoNotCloseButHide = True Then
  Stop Event


that will hide the window and stop the app closing on pressing the x.

Hope that makes sense.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220110/0443ef84/attachment.htm>

More information about the User mailing list