【发布时间】:2019-08-06 12:50:39
【问题描述】:
我有一个查询在单独的线程中运行,需要一段时间来处理,因为用户目前无法知道后台正在执行某些操作我想创建一个进度条,如第三个进度条这张图片:
我查看了其他问题/答案,看起来我想要一个字幕进度条,我尝试将我的进度条设置为字幕,但它没有做任何事情。进度条属性如下:
MarqueeInterval = 10
Max = 100
Min = 50
Orientation = pbHorizontal
Position = 50
Smooth = True
State = pbsNormal
Step = 10
Style = pbstMarquee
我做错了什么或需要改变吗?
我的启动代码如下:
procedure TFormMain.SetupForm;
begin
// Connect to the database
ConnectToDatabase;
// Initially hide combo box
ShowHideComboBox(False);
ListViewDataType.Columns[0].Width := -1;
UsingOwnTemplate := False;
// Initial page is the welcome page
PageControl.ActivePage := TabWelcome;
end;
procedure TFormMain.ConnectToDatabase;
var
FullPath : String;
CompanyName: String;
begin
// Create the database connection
DBConnection := TFDConnection.Create(nil);
// Get the folder path
FullPath := GetCurrentDir;
DatabasePath := FullPath;
// Setup the database connection
with DBConnection do begin
DriverName := 'MSAcc';
Params.Add(Format('Database=%s', [DatabasePath]));
Params.Add('StringFormat=UNICODE');
Connected := True;
end;
end;
【问题讨论】:
-
@TomBrunberg 是的,这是给
Vcl的。 -
我在您的代码中看不到任何与另一个线程相关的内容。我只看到在主线程中使用的数据库组件。这些组件根本不能跨线程边界使用。因此,要么您向我们发布了错误的无关代码,要么您实际上是在主线程而不是另一个线程中运行查询。
标签: delphi progress-bar