English 中文(简体)
利用DelphicVclCall
原标题:using LocalAsyncVclCall in Delphi
  • 时间:2010-04-01 16:19:59
  •  标签:
  • delphi

事实上,我正在使用AsyncCalls图书馆,以这种方式执行文法。

       while AsyncMultiSync([RunQuery], True, 10) = WAIT_TIMEOUT do
       begin
            FrmProgress.refresh; //Update the ellapsed time in a popup form
            Application.ProcessMessages; 
       end;

并且一切都奏效。

现在,我想在电网中填满电梯时也这样做。

i)

         while LocalAsyncVclCall(@InitGrid, 10) = WAIT_TIMEOUT do
         begin
              FrmProgress.refresh;
              Application.ProcessMessages;
         end;

但显然没有汇编,因为当地AsyncVclCall返回的类型是IAsyncCall,而不是卡迪纳尔。

同时也试图这样做,但并不是因为电网程序已经执行,而不是仓促执行。

             while not LocalAsyncVclCall(@InitGrid, 10).Finished do
             begin
                  FrmProgress.refresh;
                  //Application.ProcessMessages;
             end;

• 如何利用地方资产管制中心或另一个职能,以同步执行《维也纳条约法公约》。

想这样做。

             while ExecuteMyVCLProcedure(@InitGrid) = WAIT_TIMEOUT do
             begin
                  FrmProgress.refresh;
                  //Application.ProcessMessages;
             end;

UPDATE The InitGrid procedure goes here, the TcxGrid does not provide any event to show the progress of the data load. because that i want to execute this procedure asynchronously.

procedure InitGrid;   
begin
  cxGrid1DBTableView1.BeginUpdate;
  try    

       cxGrid1DBTableView1.DataController.DataSource:=DataSource1;//in this point assign the query previously executed to the grid. 

       cxGrid1DBTableView1.ClearItems;
       cxGrid1DBTableView1.DataController.CreateAllItems;

       for ColIndex:=0 to cxGrid1DBTableView1.ColumnCount-1 do
       cxGrid1DBTableView1.Columns[ColIndex].Options.Editing:=False;

  finally
    cxGrid1DBTableView1.EndUpdate;
  end;

end;

提前感谢。

最佳回答

UPDATE The InitGrid procedure goes here, the TcxGrid does not provide any event to show the progress of the data load. because that i want to execute this procedure asynchronously

You can t populate the cxGrid in a different VCL thread because there is only one VCL Thread, the MainThread. Calling LocalAsyncVclCall from the MainThread does nothing else than executing the given function in the thread that calls LocalAsyncVclCall. So it wouldn t do anything different than calling the InitGrid() function in the same thread where your ProcessMessages() call is. Hence ProcessMessages() would be called after the data was loaded into the cxGird what is not what you want.
All the *VclCall() functions are intended to be executed from a different thread than the MainThread.

如果不修改《消除饥饿守则》,支持“侵略事件”,你就没有尝试。

问题回答

• 利用邮政系统向护堤发送海关窗口信息。

e.g

WM_PopulateGrid = WM_USER + 1;

procedure WMPopulateGrid(var msg: TMessage); message WM_PopulateGrid;
begin
  //load records into the grid. 
  //You maybe can use a global variable to pass the records from RunQuery
  ....
end;




相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签