Jump to content

Setfocus() In CallBack Procedure For Form's ShowModal Ignored


Frederick

Recommended Posts

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)
 

Link to comment
Share on other sites

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;

 

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
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!]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 8 months later...

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.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...