Cannot Focus a Disabled or Invisible Window lazarus / 31-LCL ---------------------------------------------------------------------- Weitentaaal · 2021-03-03 16:24 Hello Guys i get this Error when i try to SetFocus in OnShow Procedure of My Form. Should i move this Part out or is there something else i can work with ? LG loch ) ---------------------------------------------------------------------- Handoko · 2021-03-03 16:40 You can try: 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   if TheControl.Visible then TheControl.SetFocus; You didn't show us the code. I had to use my tele-vision eye but the image was blurry due to the weather. ---------------------------------------------------------------------- ASerge · 2021-03-03 16:42 Quote from: Weitentaaal on March 03, 2021, 05:24:38 pmi get this Error when i try to SetFocus in OnShow Procedure of My Form. Use ActiveControl := ... instead. ---------------------------------------------------------------------- balazsszekely · 2021-03-03 17:01 Form.ActiveControl is the easiest solution, as @ASerge already mentioned. If you have to use SetFocus, always check if the control can receive focus: 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 if Control.CanFocus then  Control.SetFocus; ---------------------------------------------------------------------- Weitentaaal · 2021-03-04 06:31 Thanks