Jump to content
uniGUI Discussion Forums
Frederick

SelectNext() Is Slow

Recommended Posts

I have the following OnKeyDown procedure for TUniDBEdit controls to move to the next control when the Return key is pressed. This procedure simulates pressing the Tab key.

procedure TForm.edtCodeKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
   if Key=VK_RETURN then
      SelectNext(Sender as TUniControl,True);
end;

There is a discernible delay of between 0.5 to 1.0 second after the Return key is pressed before the next control is focused compared with pressing the Tab key. How do I speed up the process?

--
Frederick
(UniGUI Complete - Professional Edition 1.90.0.1504)
 

Using Tab To Tab.gif

Using Return To Tab.gif

Share this post


Link to post
Share on other sites
1 hour ago, Frederick said:

How do I speed up the process?

Hi,

Please see this demo:

\FMSoft\Framework\uniGUI\Demos\Desktop\FormNavigate

UniForm2.NavigateKeys.Enabled...

UniForm2.NavigateKeys.Next.Key ...

Share this post


Link to post
Share on other sites
6 hours ago, Sherzod said:

Hi,

Please see this demo:


\FMSoft\Framework\uniGUI\Demos\Desktop\FormNavigate

UniForm2.NavigateKeys.Enabled...

UniForm2.NavigateKeys.Next.Key ...

Thanks. These settings allowed the Return key as Tab to match the speed of the Tab key.

Share this post


Link to post
Share on other sites
4 hours ago, Abaksoft said:

Frederick

Use instead AJAX Event. 

This is Client Side Technic,  very Fast :)

See attachment

ClientSide_Focus.zip

Thanks for the code. The Ajax code for the three TUniEdit controls on the left explicitly focuses the next edit control. How will the Ajax code be if it is to be based on the tab order?

Share this post


Link to post
Share on other sites

Hi,

I use the following and very satisfied, 

in the MainForm properties

KeyPreview := True

NavigateKeys.Cycle := True;

NavigateKeys.Enabled := True;

NavigateKeys..Next.key := 13;

NavigateKeys.Prior.Key :=13;

NavigateKeys.Prior.ShiftState := [ussShift];

 

 

 

Share this post


Link to post
Share on other sites
On 7/16/2019 at 4:03 PM, Frederick said:

>  How will the Ajax code be if it is to be based on the tab order?

 

There is no thing to do with TAB key. TAB order is seting by default when you put your components on Design time.

Ofcourse as you know it, you can change components order by opening sub menu "Create Order", on Right Click, on the form (designTime).

Share this post


Link to post
Share on other sites
4 hours ago, Abaksoft said:

 

There is no thing to do with TAB key. TAB order is seting by default when you put your components on Design time.

Ofcourse as you know it, you can change components order by opening sub menu "Create Order", on Right Click, on the form (designTime).

In UniEdit1's OnAjaxEvent, you have the following code:-

  if EventName='CarriageReturn' then
     UniEdit2.JSInterface.JSCall('focus',[]);

UniEdit2 is explicitly specified as the next edit control to focus to when the ENTER key is pressed in UniEdit1.

This is repeated for UniEdit2 where the focus goes to UniEdit3 and then in UniEdit3, where the focus goes back to UniEdit1.

UniEdit1 --> UniEdit2 --> UniEdit3 --> UniEdit1

This is fine if my tab order is UniEdit1 to UniEdit2 to UniEdit3.

What if I change my tab order to UniEdit1 to UniEdit3 to UniEdit2? Do I have to change the event code to reflect the new tab order?
 

Share this post


Link to post
Share on other sites

We can not have the sun and the moon together :)

You have to choose the correct behavior on design step.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×