delphidelphi-xeanydac

AnyDac form design, programming query cancel dialog


I'm having a problem with my AnyDac Cancel dialog from TADGUIxAsyncExecuteDialog component, basically i need the user to be able to cancel the query execution it works perfectly but the design doesn't match the program what i need is to edit the form that shows for the user to my needs, delete the icon of AnyDac change the caption etc.. any ideas how i can do this?

I'm using AnyDac 6.0.3 Build 2713 Delphi XE

tried searching all over the internet for a week's now, no luck :)


Solution

  • Found a workaround :)

        while AnyQuery.Command.State = csExecuting do
        begin
          Application.ProcessMessages;
          //do anything here while query is executing
          //the query has to be set to ResourceOptions.CmdExecMode = amAsync
          end;
        end;
    

    Also you can cancel the query by executing the following command

    AnyQuery.AbortJob(False);
    

    My code looks like this:

    AnyQuery.Active;
    ShowProgressForm:= TShowProgressForm.Create(Application); 
    ShowProgressForm.Label1.Caption := 'Generating Query Please Wait...';
    
    while AnyQuery.Command.State = csExecuting do
    begin
          Application.ProcessMessages;
    
          if ShowProgressForm.Cancel then
          begin
            AnyQuery.AbortJob(False);
            ShowProgressForm.Close;
            EXIT;
          end;
    end;
    
    ShowProgressForm.Close;
    

    The Cancel is a global boolean variable declared in the ShowProgressForm.pas when you press the Cancel button the variable becomes True and the AbortJob(False) method will abort query execution :)

    Hope it helps :)