quit app by dock or mac-menu

Mac OSX specific forum
delikanli_19_82
User
User
Posts: 38
Joined: Tue Jun 21, 2011 6:11 pm

quit app by dock or mac-menu

Post by delikanli_19_82 »

there is a problem,

if i want to quit the app by the mac-dock or from the applications's menu, where the app-name is topic by choose the entry called "Quit...", it doesn't respond.

how can i solve this problem?

please help :-)
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: quit app by dock or mac-menu

Post by WilliamL »

I'm not sure I understand what you are asking but if the app you created is not responding you can always go to the Apple menu and use 'Force Quit".
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: quit app by dock or mac-menu

Post by Polo »

Use the predefined constant #pb_menu_quit :)
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: quit app by dock or mac-menu

Post by WilliamL »

Yeah, good thought Polo,
'-pre defined constants of #PB_Menu_About, #PB_Menu_Preferences,#PB_Menu_Quit'
http://www.purebasic.fr/english/viewtop ... 19&t=45613
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
delikanli_19_82
User
User
Posts: 38
Joined: Tue Jun 21, 2011 6:11 pm

Re: quit app by dock or mac-menu

Post by delikanli_19_82 »

hello guys,

i couldn't find a solution yet. here a better description:

think the application's name is "my_app". if you start my_app, you get it's menu at the top of the screen, beside the apple-logo.

if you click on the my_app-name, it pulls out a popup-menu. at the bottom of the popup-menu there is a entry called "Quit...". if you click on it, the my_app should end, but don't.

a second method is, if you click longer then one second on the my_app-icon in the dock. a popup-menu also pulls out. also there you can click on a option called "Quit" to quit the application.

i am using a german surface, therefore i am not sure, if the option is called "Quit" or "Close" in the english original.

the #pb_event_closewindow is normally used in code to finish the application. if you click on the red colored close-button of the window itself, the app finishs. if i try one of the described ways above, it doesn't works. i have no idea, why...

i need help :-)
please help :-)
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: quit app by dock or mac-menu

Post by Polo »

We gave you the solution!
delikanli_19_82
User
User
Posts: 38
Joined: Tue Jun 21, 2011 6:11 pm

Re: quit app by dock or mac-menu

Post by delikanli_19_82 »

ok, i found something to solve this problem.

...
if e = #pb_event_menu and eventmenu() = #pb_menu_quit
end
endif
...

thanks

:-)
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: quit app by dock or mac-menu

Post by WilliamL »

Ok, I see what you are saying. You may have already figured it out but...something like this.

[edit] It looks like I asked this same question 4 years ago. http://www.purebasic.fr/english/viewtop ... 19&t=34046 :)

Code: Select all

If OpenWindow(0, 0, 0, 230, 90, "Event handling example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateMenu(0, WindowID(0))
        MenuTitle("File")
        MenuItem(1, "One")
        MenuItem(2, "Two")
        MenuItem(#PB_Menu_Quit, "Quit")
    EndIf 

    Repeat
        Event = WaitWindowEvent()
        Select Event
        Case #PB_Event_Menu
            MenuID=EventMenu() : Debug MenuID
            Select MenuID
            Case #PB_Menu_Quit
                End
            EndSelect
        EndSelect
    Until Event = #PB_Event_CloseWindow
 EndIf
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
delikanli_19_82
User
User
Posts: 38
Joined: Tue Jun 21, 2011 6:11 pm

Re: quit app by dock or mac-menu

Post by delikanli_19_82 »

programming means also studying. you could never know everything. sometimes also so simple things.

thanks again :-)
Post Reply