The computer freezes when clicking to fast

<< Click to Display Table of Contents >>

Navigation:  Forum >

The computer freezes when clicking to fast

Forum link

 

Pages: 1 2

 


 

05-14-2020, 09:08 AM:

 

Hi,

 

I experience unexpected freezing.

 

The program runs much slower then in Delphi, so a simple procedure of a few lines the wait sign appears for less then a second.

 

So for example when I click on a listbox, the first command is disabling the listbox and at the and of the procedure enabling again, otherwise when you click 2 times the program freezes.

 

The same I have when switching form one form to another and back.

 

Is this normal and what to do?

 


 

05-14-2020, 02:00 PM:

 

There is not nearly enough info in this message to even begin to help.

 

Do you have any issues with the Guess demo?

 


 

05-14-2020, 04:45 PM:

 

No, just a small new application, with a few listboxes with on click a few lines of code.

 

Just 4 form-pages, nothing complex.

 

What information do you need?

 

I can send you the code... or give you the page and login code.

 


 

05-14-2020, 09:50 PM:

 

(05-14-2020, 04:45 PM)newuser Wrote: [ -> ]No, just a small new application, with a few listboxes with on click a few lines of code.

 

Just 4 form-pages, nothing complex.

 

What information do you need?

 

I can send you the code... or give you the page and login code.

 

Are you setting

 

LockUntilLoaded := true;

 

  LockOnSubmit    := true;

 


 

05-15-2020, 07:18 AM:

 

Yes, both are checked on every form

 


 

05-16-2020, 10:22 AM:

 

I used the on click.

 

Now I tried the onAsincClick and set the LockOnAsyncEvents true.

 

Now there is no freezing.

 

Is this normal and should one not use the onClick?

 


 

05-16-2020, 04:36 PM:

 

You have not even shown your code for your onclick. Im sorry but we are not mind readers.

 


 

05-16-2020, 08:11 PM:

 

I'm sorry,

 

It is on most click events.

 

Code:

 

procedure TfmReserveer.lbLessoortClick(Sender: TObject);

 

begin

 

  if lbLessoort.ItemIndex >= 0 then

 

  begin

 

    lbLessoort.Enabled := false;

 

    UserSession.qLessoort.Locate('Volgnr', Lesnrs[lbLessoort.ItemIndex], []);

 

    UserSession.qLessen.First;

 

    lbLessen.Clear;

 

    while not UserSession.qLessen.Eof do

 

    begin

 

      UserSession.qCheckOfVol.Parameters[0].Value := UserSession.qLessenVOLGNR.AsInteger;

 

      UserSession.qCheckOfVol.Parameters[1].Value := DatumVanLes;

 

      UserSession.qCheckOfVol.Open;

 

      if UserSession.qCheckOfVolaantal.AsInteger >= UserSession.qLessenMAXAANTAL.AsInteger then

 

        lbLessen.Items.Addpair(weekdagen[UserSession.qLessenDAG.AsInteger] + ' ' + UserSession.qLessenSTARTUUR.AsString + ':' + PadLeft(UserSession.qLessenSTARTMIN.AsString, 2, '0'), 'vol')

 

      else

 

        lbLessen.Items.Add(weekdagen[UserSession.qLessenDAG.AsInteger] + ' ' + UserSession.qLessenSTARTUUR.AsString + ':' + PadLeft(UserSession.qLessenSTARTMIN.AsString, 2, '0'));

 

      UserSession.qLessen.Next;

 

    end;

 

    lbLessoort.Enabled := true;

 

  end;

 

  lReserveer.Caption := '';

 

  bReserveer.Enabled := false;

 

end;

 

Thank you for your quick respons!

 


 

05-16-2020, 11:31 PM:

 

If you are cycling an entire dataset its likely slow. Replace your click event with something simple like updating a label or button and no extra code and you will see that it is not IW slowing things down.

 

You are setting params and opening a dataset inside of a loop which will be very slow as well.... If that loop is 1000 items then its repreparing and reopening a qCheckOfVol that many times. This code would run just as slow in a desktop app as it does in IW. There is no difference in such code desktop or IW.

 


 

05-24-2020, 10:15 AM:

 

So, I noticed that in contrast with a Delphi program, you can press a button while it is still processing.

 

Which way to go?

 

You one lock / disable every button on click when there is a litle bit more code to process?

 

When yes, a suggestion for new releases to make a property for this?

 

Or is there a better way?