Bounce my app in dock

Mac OSX specific forum
SimonG
New User
New User
Posts: 2
Joined: Mon May 09, 2022 8:24 am

Bounce my app in dock

Post by SimonG »

Hi all

I'm looking for a way to "bounce" the icon of may app.

Thanks in advance
User avatar
mk-soft
Always Here
Always Here
Posts: 5334
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Bounce my app in dock

Post by mk-soft »

After starting another program set the focus

Code: Select all

;-TOP

#NSCriticalRequest = 0

Global NSApp.i = CocoaMessage(0, 0, "NSApplication sharedApplication")

Procedure UpdateWindow()
  Protected dx, dy
  dx = WindowWidth(0)
  dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
  ; Resize Gadgets
EndProcedure

Procedure Main()
  Protected dx, dy
  
  #WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
  
  
  If OpenWindow(0, #PB_Ignore, #PB_Ignore, 600, 400, "Test Window", #WinStyle)
    ; MenuBar
    CreateMenu(0, WindowID(0))
    MenuTitle("File")
    
    ; StatusBar
    CreateStatusBar(0, WindowID(0))
    AddStatusBarField(#PB_Ignore)
    
    ; Gadgets
    dx = WindowWidth(0)
    dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
    
    ; Bind Events
    BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
    
    AddWindowTimer(0, 0, 5000)
    
    SetWindowState(0, #PB_Window_Minimize)
    
    ; Main Loop
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Select EventWindow()
            Case 0
              Break
          EndSelect
          
        Case #PB_Event_Menu
          Select EventMenu()
            
          EndSelect
          
        Case #PB_Event_Gadget
          Select EventGadget()
              
          EndSelect
          
        Case #PB_Event_Timer
          Select EventTimer()
            Case 0
              RemoveWindowTimer(0, 0)
              CocoaMessage(0, NSApp, "requestUserAttention:", #NSCriticalRequest)
          EndSelect
          
      EndSelect
    ForEver
    
  EndIf
  
EndProcedure : Main()
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
SimonG
New User
New User
Posts: 2
Joined: Mon May 09, 2022 8:24 am

Re: Bounce my app in dock

Post by SimonG »

Thanks !!!
Post Reply