When change to another form i tried to focus a tmemo don't work lazarus / 21-General ---------------------------------------------------------------------- eldonfsr · 2024-10-10 23:51 Hi I have a app with two forms first i have tmemo with event on keypress when i called or active the second form and close and back to previous form checked focus is on tmemo but when press enter or type any key and check if tmemo is focused sad not focused.... calling form 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 procedure TFormMain.MIForcSpeedClick(Sender: TObject);begin//  if( PanelChart.Visible ) then BtnClearChartClick(Sender) ;    if not Assigned(FormSettings) then begin       Application.CreateForm(TFormSettings,FormSettings);    end;    FormSettings.Left:= FormMain.Left+30;    FormSettings.top := Formmain.Top+110;    FormSettings.ShowModal;    If VTerminal.Visible then begin       VTerminal.setfocus;    end else begin       ComTerm.SendFocus;    end;end;       on form key press checking if has focused and sad not focused 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 procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char);begin if( Key =#13) then begin    if(( Not Comterm.Focused) and (Not VMterminal.Focused)  ) then begin      FormMain.SelectNext(FormMain.ActiveControl,true, true);      key:=#0;    end; end;end;   there are a way to save status of form and when back restore form or howi can forcce focus to tmemo.. hope same help thanks.. ---------------------------------------------------------------------- Zvoni · 2024-10-11 07:58 FormSettings is in Modal mode...... ---------------------------------------------------------------------- eldonfsr · 2024-10-11 12:43 Yes is Showmodal i change to who buts still same way focus is tmemo but when i type somthing is triger event of form and i check there if tmemo has focus for avoid select next control got focus and can still tying on tmemo the other way tmemo lose focus.... in only way to manage enter work  like tab.