Global Floating Window Loses Focus

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=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.

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

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 …