Frederick Posted July 17, 2019 Share Posted July 17, 2019 I added a callback procedure in a form's ShowModal like the following:- Procedure TMyMain.btnClick(Sender : TObject); begin MyForm2.ShowModal(CloseForm); end; Procedure TMyMain.CloseForm(Sender : TComponent: AResult : Integer); begin showmessage('here'); UniEdit1.Setfocus; end; When MyForm2 closes, the ShowMessage() is seen but the code to focus to the TUniEdit control is ignored. Even when I remove the ShowMessage() call, the Setfocus code is still ignored. What am I doing wrong? -- Frederick (UniGUI Complete - Professional Edition 1.90.0.1504) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 17, 2019 Share Posted July 17, 2019 16 minutes ago, Frederick said: Even when I remove the ShowMessage() call, the Setfocus code is still ignored. Hello, Can you make a simple testcase for reproduce?! Quote Link to comment Share on other sites More sharing options...
Frederick Posted July 17, 2019 Author Share Posted July 17, 2019 1 hour ago, Sherzod said: Hello, Can you make a simple testcase for reproduce?! Please find attached. SModal.7z Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 17, 2019 Share Posted July 17, 2019 49 minutes ago, Frederick said: Please find attached. As a workaround, you can try to use this approach: procedure TMainForm.CloseMyForm2(Sender : TComponent; AResult : Integer); begin //UniEdit1.Setfocus; UniEdit1.JSInterface.JSCallDefer('focus', [False], 100); end; 1 Quote Link to comment Share on other sites More sharing options...
Frederick Posted July 17, 2019 Author Share Posted July 17, 2019 Thanks. This works as expected. Quote Link to comment Share on other sites More sharing options...
neo4a Posted August 7, 2019 Share Posted August 7, 2019 On 7/17/2019 at 11:31 AM, Sherzod said: As a workaround, you can try to use this approach: procedure TMainForm.CloseMyForm2(Sender : TComponent; AResult : Integer); begin //UniEdit1.Setfocus; UniEdit1.JSInterface.JSCallDefer('focus', [False], 100); end; It seemed that this problem still exists in 1.9x. Should I open a bug ticket or is it allready set in focus? [sic!] Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 7, 2019 Author Share Posted August 7, 2019 1 hour ago, neo4a said: It seemed that this problem still exists in 1.9x. Should I open a bug ticket or is it allready set in focus? [sic!] Yes, please open a bug ticket. The JS call command does not work all the time in 1.90.1506. I am surprised that a simple command to focus on a control will trip UniGUI. Quote Link to comment Share on other sites More sharing options...
neo4a Posted August 7, 2019 Share Posted August 7, 2019 9 minutes ago, Frederick said: Yes, please open a bug ticket. The JS call command does not work all the time in 1.90.1506. I am surprised that a simple command to focus on a control will trip UniGUI. I'm sorry, but this question was rhetorical and aimed at a dialogue/thread I had with the moderator yesterday. Quote Link to comment Share on other sites More sharing options...
Frederick Posted August 7, 2019 Author Share Posted August 7, 2019 6 minutes ago, neo4a said: I'm sorry, but this question was rhetorical and aimed at a dialogue/thread I had with the moderator yesterday. OK, never mind. I'll follow up with technical support later. Quote Link to comment Share on other sites More sharing options...
LogSistemas01 Posted May 5, 2020 Share Posted May 5, 2020 Hello, I realized today that the problem of setfocus still occurs. I have the current trial version. The informed function JSCallDefer worked. If you do the same operation with Showmessage, it works normally with uniEdit.Setfocus; I don't know if it has already been fixed, I would open a topic, but as I located this topic, I'm just giving feedback here. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.