Is there a setting I need to change to correct this?
Any help appreciated
Ekkas
Wordpad always uses the latest rich edit version available on the
Windows version it comes with. TRichedit still uses version 1.0,
TJvRichedit probably uses version 2 or 3. For the feature you want
version 4 is needed if memory serves.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
"Peter Below (TeamB)" <no...@nomail.please> wrote in message
news:xn0fnonn...@newsgroups.borland.com...
> Is there a way to force TRichEdit or TJvRichEdit to use the ver 4, or
> is that not compatible? Or any other RichEdit component for Delphi
> that is not dependent on DotNet.
You will get version 3 with TJvRichEdit automatically, if memory
serves, but version 4 is in a different DLL (Msftedit.dll) and I don't
know how compatible its interface is with version 3. The main problem
with V4 is that it is not available on platforms < XP SP1 and it is not
redistributable, as far as I know. Another problem is that V4 uses the
same window class name as V2 and V3, even though it is in a different
DLL. However, that may offer a way to magically make TJvRichedit use V
4, by explicitely loading msftedit.dll *after* the TJVRichEdit has
loaded riched20.dll but *before* it has created its window handle.
Add an Initialization section to your main forms unit. In it place a
call
Initialization
LoadMsftEditDLL;
Above the Initialization add
procedure LoadMsftEditDll;
var
hDLL: THandle;
begin
hDLL := SafeLoadLibrary('msftedit.dll');
if hDLL = 0 then
MessageBox(0, 'Rich edit version 4.1 not installed, using version 2
or 3', 'Fallback', MB_OK or MB_ICONINFORMATION);
end;
Build and run and test whether the TJVrichedit now correctly displays
your problem tables.
No warranties...
Although your patch didn't work, I'm seeing a glimmer of hope...
As you'll see below, shouldn't there be a
CreateSubClass(Params,'RICHEDIT50W') somewhere in your patch?
Now that I knew what to search for (msftedit.dll), uncle Google gave me this
page, messy, but working! I tried similar changes for TJvRichEdit,as
TRichEdit doesn't display images, with a few tweaks, I got it working. Now
just to let the JEDI guys know about this... I also included a version check
before loading the new DLL/CreateSubClass, so in Win98 the older DLL should
still load as msftedit.dll is apparently only included from XPsp1.
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_21356661.html
basically telling how to override the TRichEdit loading of the DLL:
For Delphi 2005 TRichEdit:
Copy ComCtrls to your project folder, so that your changes are local to the
project.
Add ComCtrls to your project, to be sure that your modified file is used
instead of Delphi stock ComCtrls.
Go to TCustomRichEdit.CreateParams and edit RichEditModuleName value as
"RichEditModuleName = 'MSFTEDIT.DLL';"
Edit the CreateSubclass call as "CreateSubClass(Params, 'RICHEDIT50W');"
Run the project and find out that an exception is raised in
TRichEditStrings.Insert. It is sort of saveguard check. Since the code looks
reasonable, most likely the version 1.0 check does not hold with version
4.1, so comment it out:
//if RichEdit.SelStart <> (Selection.cpMax + Length(Str)) then
// raise EOutOfResources.Create(sRichEditInsertError);
Now "richEdit.Lines.LoadFromFile(OpenDialog.FileName);" displays correctly
formatted table. I do not know if there are other incompatibilities between
Delphi version 1.0 code and used version 4.1.
> As you'll see below, shouldn't there be a
> CreateSubClass(Params,'RICHEDIT50W') somewhere in your patch?
That was the missing piece I could not find on short notice. The MSDN
page for richedits mentions the existence of V. 4 but gives the
impression that it uses the same classname as the V 2 and 3.
Thanks a lot
Your input set me on the right track.
AntonE