It is currently Fri Oct 30, 2020 2:45 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Bring Window to the Front
PostPosted: Wed Apr 08, 2020 3:13 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 13, 2004 2:37 pm
Posts: 143
Location: Ottawa, Canada
I've written a cross platform application for Windows and Mac. It sits on the system tray and when there is a trigger, a window pops up. On Windows I can force the window to the top, so it is always visible, no matter what application I am working on. For the Mac, I can't seem to find the same functionality. So in essence I want to unhide a window, which works, but also make this window appear foremost. Does anyone have any pointers for achieving this?

Thanks

_________________
Colin


Top
 Profile  
Reply with quote  
 Post subject: Re: Bring Window to the Front
PostPosted: Wed Apr 08, 2020 3:16 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 1150
Location: Amphibios 9
StickyWindow() does not work on a Mac?

Greetings ... Peter

_________________
Hygge


Top
 Profile  
Reply with quote  
 Post subject: Re: Bring Window to the Front
PostPosted: Wed Apr 08, 2020 4:14 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 523
Maybe you need to bring the whole program to front.

Code:
#NSApplicationActivateAllWindows = 1 << 0
#NSApplicationActivateIgnoringOtherApps = 1 << 1

currentApplication = CocoaMessage(0, 0, "NSRunningApplication currentApplication")
CocoaMessage(0, currentApplication, "activateWithOptions:", #NSApplicationActivateAllWindows | #NSApplicationActivateIgnoringOtherApps)


Top
 Profile  
Reply with quote  
 Post subject: Re: Bring Window to the Front
PostPosted: Wed Apr 08, 2020 4:26 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 13, 2004 2:37 pm
Posts: 143
Location: Ottawa, Canada
Kiffi wrote:
StickyWindow() does not work on a Mac?

Greetings ... Peter

Thanks Peter, wasn't even aware of that one. Works well.

_________________
Colin


Top
 Profile  
Reply with quote  
 Post subject: Re: Bring Window to the Front
PostPosted: Wed Apr 08, 2020 4:27 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 13, 2004 2:37 pm
Posts: 143
Location: Ottawa, Canada
Wolfram wrote:
Maybe you need to bring the whole program to front.

Code:
#NSApplicationActivateAllWindows = 1 << 0
#NSApplicationActivateIgnoringOtherApps = 1 << 1

currentApplication = CocoaMessage(0, 0, "NSRunningApplication currentApplication")
CocoaMessage(0, currentApplication, "activateWithOptions:", #NSApplicationActivateAllWindows | #NSApplicationActivateIgnoringOtherApps)

Thanks Wolfram. HAven't checked this one as the other works and also gives me the benefit of having the same code for Windows.

_________________
Colin


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye