Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The computer freezes when clicking to fast
#1
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?
Reply
#2
There is not nearly enough info in this message to even begin to help.

Do you have any issues with the Guess demo?
Reply
#3
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.
Reply
#4
(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;
Reply
#5
Yes, both are checked on every form
Reply
#6
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?
Reply
#7
You have not even shown your code for your onclick. Im sorry but we are not mind readers.
Reply
#8
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!
Reply
#9
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.
Reply
#10
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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)