Good afternoon to all,
there's a strange "problem" with AdvRichMemo and it's FormatButtonBar.
In your demo https://www.tmssoftware.com/site/blog.asp?page=1 thare's an example on how to use advrichmemo. The demo works well.
But there's a litle problem on a different creating order.
To reproduce what append to me (very easy)
New project with 2 forms; the first one (form1) as main form with 1 button, butonclick call only a procedure called TST.
The second form is NOT autocreate and have 1 panel with AdvrichMemo and it's own formatbuttonbar linked.
the TST procedure is
Procedure TST;
begin
form2.Create(Nil);
try
form2.ShowModal;
finally
FreeAndNil(form2);
end;
end;
What's append is when i click on the button (form1) i got an AccessViolation error.
If i change the creating order and the form 2 is autocreated (project, options, forms, auto-create)
and change the tst procedure into
Procedure TST;
begin
form2.ShowModal;
end;
all works.
This for test, in real project where the forms are NOT AUTOCREATED and are created when the procedure are called and destroied when them are closed, i have a mix of strange behaviors all with the same access violation error: one is as above, another is when an image is deleted (after loaded) in any place into the advrichmemo.
Here the .pas files for the test project in order to reproduce the problem
* project *
program Project1;
uses
Vcl.Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R .res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Form1 *
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
Unit2;
{$R .dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
TST;
end;
end.
form2 *
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, AdvScrollControl, AdvRichEditorBase,
AdvRichEditor, AdvRichEditorFormatButtonBar, Vcl.ExtCtrls;
type
TForm2 = class(TForm)
Pnl2: TPanel; // Is a container for other two components
advrchdtrfrmtbtnbr1: TAdvRichEditorFormatButtonBar;
RMM1: TAdvRichEditor;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
procedure TST;
implementation
{$R *.dfm}
Procedure TST;
begin
form2.Create(Nil);
try
form2.ShowModal;
finally
FreeAndNil(form2);
end;
end;
end.
Thank's for your help
Regards
Daniele
I'm sorry but I cannot reproduce this.
Our test project is here:
Hi Bruno,
thank's for your quik reply!
I got your demo and works fine as expected.
Now, without doing nothing, j recompiled my project and ... works fine!
Compiler's mystery !!
Thank's again
Daniele
Hi Bruno,
compiler mystery solved !!
I have Eureka log installed.
If it is active, j get the problem ... if it is not active all works well.
(note that is with all projects, even with the test program you sent).
Due the fact that eureka log con have thousand configuration (even if i have the standard configuration) ... is very hard try to understand where the problem is.
At the moment i have deactivate eireka log in release configuration.
Thank's again
Daniele
PS: It's very interesting the fact that (with eureka log active) this (pseudo) issue is fired up only if the form is not autocreate. I'll send an email also to them
Is this the latest version of Eurekalog, as we have this installed in Delphi Tokyo 10.2 as well, but cannot see an issue.