[solved]SetFocus Error: SetKeyboardFocus failed lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- dbannon · 2017-10-10 11:07 I have made a small cross platform app that starts a TrayIcon and then, when the user so clicks, pops up a window or two. In one case the Window is the main unit (that I hide when I start the TrayIcon) and in others, its a Form I create new instances of. On the Mac, I find that while it works fine from within lazarus (including Run without Debugging) if I launch it outside of Lazarus, the windows that appear do not get focus, I can see them, sometimes behind an existing window but they are inactive and anything I type is directed to the terminal I started from. I see messages like this at the terminal - Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TCarbonRadioButton.SetFocus Error: SetKeyboardFocus  failed with result -30585TCarbonRadioButton.SetFocus Error: SetKeyboardFocus  failed with result -30585TCarbonBitBtn.SetFocus Error: SetKeyboardFocus  failed with result -30585Both Linux and Windows work fine. The forms I create instances of are started like this - Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i EBox := TEditBoxForm.Create(Application); EBox.Show;I have added the following to try fix this but no good - Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i EBox.KMemo1.SetFocus; Do you have any suggestions ?  Its well worth noting I am a real mac newbe ! Don't be afraid to suggest something obvious. David ---------------------------------------------------------------------- dbannon · 2017-10-10 11:24 OK, same thing happens with the very minimal button on a blank form app. Clearly I don't know enough about Macs..... So, look a bit closer. I have made an application bundle, it contains, down a couple if directories, a link back to my binary. So, I find, if I start from the link, it works, if I start directly from the binary, it fails. Hmm. Anyway, my problem solved.... Macs are a funny beast, they really are ! David ---------------------------------------------------------------------- tudi_x · 2017-10-20 10:21 hi, i just learned that on Carbon the way applications are run is from the Bundle (app created structure). so the proper way to run, the one in which you are not getting the error is: cd myproject open project1.app more information in http://forum.lazarus.freepascal.org/index.php/topi c,19834.msg113456.html#msg113456