I use the component TAdvSmoothMessageDialog to show messages.
In some cases, closing a message box, the focus is altered and the related methods are not executed properly.
One case is when a message is displayed in the OnExit event of a TEdit: in this case the events connected with the next TEdit no longer work, as if they were disabled.
When the message is closed, the next TEdit is shown without the blinking cursor even if you can write in it.
This particular situation does not occur if the form on which TEdits are present is the MainForm.
The one below is the sample code to be applied to a form (not MainForm) containing two TEdits and a TAdvSmoothMessageDialog:
function TForm2.MyShowMessage(Txt: string; Buts: array of string): Integer;
const Shift = 100;
var I: Integer; S: String;
begin
with AdvSmoothMessageDialog1 do begin
Buttons.Clear;
for I := Low(Buts) to High(Buts) do begin
with Buttons.Add do begin
Caption := Buts;
ButtonResult := I + 1 + Shift;
end;
end;
HTMLText.Text := txt;
Result := ExecuteDialog - Shift;
end;
end;
procedure TForm2.Edit1Exit(Sender: TObject);
begin
MyShowMessage('test message', ['&OK']);
end;
procedure TForm2.Edit2Exit(Sender: TObject);
begin
Caption := 'ExitEsecuted'; // something to do -------> this code don't execute! <-------
end;
Can you give me directions to resolve or to work around the problem?
Many thanks.
Raffaella Zanchi