# Global Floating Window Loses Focus

**URL:** <https://forum.xojo.com/t/global-floating-window-loses-focus/17661>\
**Category:** macOS\
**Created:** [July 2, 2014, 6:17pm UTC](https://forum.xojo.com/t/global-floating-window-loses-focus/17661 "2014-07-02T18:17:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulo\_Vargas](https://forum.xojo.com/user_avatar/forum.xojo.com/paulo_vargas/32/232_2.png) [@Paulo\_Vargas](https://forum.xojo.com/u/Paulo_Vargas)\
**Post date:** [July 2, 2014, 6:17pm UTC](https://forum.xojo.com/t/global-floating-window-loses-focus/17661/1 "2014-07-02T18:17:22Z")

</div>

Hello everyone,

```
          I wonder if anyone can help me for my project that is originally inCARBON, in COCOA the main window loses focus and I have to click on the Desktop and in the top bar so that it is in the foreground below, can anyone tell me how to fix this COCOA or some workaround? 

```

I appreciate any help!

---

<div class="post-metadata">

**Author:** ![Gavin\_Smith](https://forum.xojo.com/user_avatar/forum.xojo.com/gavin_smith/32/13901_2.png) [@Gavin\_Smith](https://forum.xojo.com/u/Gavin_Smith)\
**Post date:** [July 2, 2014, 9:00pm UTC](https://forum.xojo.com/t/global-floating-window-loses-focus/17661/2 "2014-07-02T21:00:50Z")

</div>

[quote=107070:@Paulo Vargas]Hello everyone,

```
          I wonder if anyone can help me for my project that is originally inCARBON, in COCOA the main window loses focus and I have to click on the Desktop and in the top bar so that it is in the foreground below, can anyone tell me how to fix this COCOA or some workaround? 

```

I appreciate any help![/quote]  
Hi Paulo, if the Global Floating window stays visible (in front of other windows) but appears to loses focus, this would actually be correct Cocoa behavior. However, if it’s not visible at all, then there’s something wrong.

I just tried in a new project and it behaves as expected.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [July 2, 2014, 9:10pm UTC](https://forum.xojo.com/t/global-floating-window-loses-focus/17661/3 "2014-07-02T21:10:24Z")

</div>

> [@107070:@Paulo Vargas](#):
>
> I wonder if anyone can help me for my project that is originally inCARBON, in COCOA the main window loses focus and I have to click on the Desktop and in the top bar so that it is in the foreground below, can anyone tell me how to fix this COCOA or some workaround?

I do not understand fully. You say that in Carbon the app kept the focus for itself, or that when the global floating window appears it should give focus to the app at the same time ?

Why not try to activate your own app through AppleScript in the window open event ?

`Tell application "myapp"
activate
end tell`

---

<div class="post-metadata">

**Author:** ![Paulo\_Vargas](https://forum.xojo.com/user_avatar/forum.xojo.com/paulo_vargas/32/232_2.png) [@Paulo\_Vargas](https://forum.xojo.com/u/Paulo_Vargas)\
**Post date:** [July 3, 2014, 1:36am UTC](https://forum.xojo.com/t/global-floating-window-loses-focus/17661/4 "2014-07-03T01:36:02Z")

</div>

Tanks Michel Bujardet and Gavin Smith

My window is sometimes up and sometimes behaves wrong and go down the other windows and know I should not be so, but what worries me the most is when she gets on top, but the top bar is as if inactive and does not recognize some commands like giving focus on a textfield or NOT recognize commands Mouse Enter, Mouse Move, etc …

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:18pm UTC](https://forum.xojo.com/t/global-floating-window-loses-focus/17661/5 "2020-10-29T17:18:15Z")

</div>


