Altering existing message on TdxAlertWindowManager
-
14-07-2021 - |
문제
I use a piece of code like this to show an alert using the TdxAlertWindowManager
.
This gives me one alert window and in this window there are several messages.
What I would like to do is to show an alert window with the first line of text and on the same window I would like to put a new text.
The program is used to connect a computer to some network shares and the message I would like to put looks like:
Connecting drive y: to \\server\foldery
Connecting drive x: to \\server\folderx
and so on for the rest of the shares.
But I can't figure out how to do it with TdxAlertWindowManager
Some years ago when I made the program I used nxAlert
from Berg software, but I don't have it available any more. On that it was no problem to do this.
if fAlertWindow = nil then
dxAlertWindowManager.Show(sHpAlertCaption, AlertText, fIndex).Tag := 1
else
begin
fAlertWindow.MessageList.Add(sHpAlertCaption, AlertText, fIndex);
fAlertWindow.RestartDisplayTimer;
end;
해결책
I don't know how to make TdxAlerWindowManager
to display new line but I know how to alter current messages. Just edit Items[0]
property of the MessageList
. I do it in timer.
var
fAlertWindow: TdxAlertWindow;
procedure TFMain.Timer1Timer(Sender: TObject);
begin
fAlertWindow := dxAlertWindowManager1.Show('Caption', 'Hello1');
Timer1.Enabled := False;
end;
procedure TFMain.Timer2Timer(Sender: TObject);
begin
fAlertWindow.BeginUpdate;
fAlertWindow.MessageList.Items[0].Text := 'Hello2';
fAlertWindow.EndUpdate;
Timer2.Enabled := False;
end;
Works 100%