Close About window

Discuss GUI programming with the RapaGUI plugin here
Post Reply
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Close About window

Post 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.
User avatar
jPV
Posts: 604
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Close About window

Post 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.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Close About window

Post 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.
User avatar
jPV
Posts: 604
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Close About window

Post 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.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Close About window

Post 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"
Post Reply