Page 1 of 1

Close About window

Posted: Tue Aug 01, 2023 11:03 pm
by papiosaur
Hello,

i have a small problem with About window.

When i click on ESC key, it quit the app without ask anything.

If i had notify=closerequest, it ask me if i want to quit app as the main window app.

If i open RAPAGUI about window, i click on ESC key, it close the window properly and keep the app open.

My question is how to close About window with ESC key without close my app.

Thanks for your help.

Re: Close About window

Posted: Wed Aug 02, 2023 9:18 am
by jPV
In your RapaGUI event function, you probably should have something like this:

Code: Select all

   Switch msg.Class
   Case "Window":
      Switch msg.Attribute
      Case "CloseRequest":
         Switch msg.ID
         Case "main_window":    ; The main window was closed, end the program
            End    ; or call your quit function
         Default:    ; If any other window was closed, just hide the window
            moai.Set(msg.ID, "Open", False)
         EndSwitch
      EndSwitch
   EndSwitch
So, the main thing is to do separate actions for separate windows if needed. I guess you have just one action for all windows.

Re: Close About window

Posted: Wed Aug 02, 2023 4:42 pm
by papiosaur
Thanks a lot jPV for the example, i understand better!

I have replaced

Code: Select all

moai.Set(msg.ID, "Open", False)
by

Code: Select all

moai.Set("about", "Open", False)
about is id of the About window and it work perfectly.

Re: Close About window

Posted: Wed Aug 02, 2023 7:45 pm
by jPV
I would keep it as msg.ID, because msg.ID will get the "about" as an value anyway. It would be more all-around code then if you happen to create another window in the program or want to re-use the code later.

Re: Close About window

Posted: Wed Aug 02, 2023 10:03 pm
by papiosaur
Ha ok, i think there is a problem in my code so because didn't work with msd.ID...but work with "about"