LEdit Version 2.07


Frequently Asked Questions:



Question: I have the LEdit package with the Delphi VCL and entered code into
the OnTimeToLoadText event that causes my program to lock up. Why?

Answer: It is likely that you are setting the Filename property from within
the OnTimeToLoadText event. This cannot be done. If you set the
Filename property in the OnTimeToLoadText event, it will cause your
program to go into an endless loop.

--------------------------------------------------------------------------------

Question: My program that uses one of the LEdit wrappers has developed a
memory leak and I cannot find anything wrong with my code. How can
I fix this?

Answer: When using the Text and TextHandle properties in the LEdit 
wrappers, memory is allocated to hold the text. We do not free this 
memory since you may want to do something else with it. You must free 
this memory yourself by calling the BurnHandle method and passing it 
the memory Handle returned by the Text and TextHandle properties. In
Delphi 2 and Delphi 3, this only applies to the TextHandle property
since the Text property in them is a Long String and does not have
this problem.

--------------------------------------------------------------------------------

Question: If I choose a background color that is, for example light 
yellow, the BGcolor is not displayed (with paintmode NORMAL). Dark 
yellow works fine. If I choose PaintMode=Direct then it looks fine
until I scroll. Then it all becomes messed up.

Answer: In Windows there are pure colors and mixed colors. Pure colors
are maintained by the video adapter. Mixed colors are created by 
Windows by interleaving pixels of different pure color. LEdit (and all
text drawing functions) maintains only pure colors. For most adapters
this is only 16 basic colors. You can work directly with the palettes
to make more true colors if you have a 256 or higher color adapters. 
For true-color video adapters all colors are automatically pure.

If you choose PaintMode=Direct, LEdit does not draw the background 
at all. You need to draw the background yourself in the OnPaint event.
This causes it to flicker. You may want to switch to 
PaintMode=UseMemoryDC. This will eliminate the flicker but will slow
down the speed a little.

--------------------------------------------------------------------------------

Question: Is there a way to change the caption in the message boxes from
LEDIT? It now displays Ledit V2.05 custum control. I want to place
something else in it.

Answer: Sure. You can do it directly by changing the resources inside 
the LEDIT.DLL (or LEDIT32.DLL) if you have a safe tool to do it with, 
like Resource Workshop. If not, we can change it for you. Just let us 
know what to change.

--------------------------------------------------------------------------------

Question: When I Close the application I want to give the user a way 
to save the text. But the Modified property does not work the way I 
expected. Anyway can you show me how I can do this? And if the user 
wants to save a file and clicks on Cancel, the Modified property is 
not changed? This is with the VCL.

Answer: Take a look at the CanClose property. It will do all the work
for you. It determines if you should close or if the user clicked 
"Cancel". If you want to change its behaviour, you may want to look at
the OnGoingToClose and OnAskIfStoreFile events.

--------------------------------------------------------------------------------

Question: How do I do HTML syntax highlighting in LEdit with the VCL?

Answer: This is very easy to do in LEdit. Basically, the way it works is
that you treat everything outside the HTML tags as comments and then
color the tags whichever color you wish. To do this, you first need to
set the Syntax property to:

  0001>1<

Then place the following code into the OnControlHighlight event.

  ForeClr := FTagForeColor;
  BackClr := FTagBackColor;
  LEdit1.MsgResult := 3;

FTagForeColor and FTagBackColor are variables defined as:

  FTagForeColor: TColor;
  FTagBackColor: TColor;

Place the foreground and background colors into these variables and 
the HTML tags will be colored this color.

Finally, set the StartInComments property to True.

This is all that is needed to have color syntax highlighting of HTML
tags. A new example of this is now included in the Delphi packages.

--------------------------------------------------------------------------------

Question: How do I make LEdit print in the background?

Answer: To print in the background, you can create two instances of LEdit.
Create one with the Visible attributes turned off and the other with the
Visible attributes turned on. Then when you are ready to print, copy the
text from the visible instance to the invisible instance and make the
invisible instance print the text. This can be done for many different
things. Another use would be to make LEdit print with different colors
that what is on the screen.

--------------------------------------------------------------------------------

Question: I installed the registered version of the VCL after evaluating 
the shareware version. When I installed the registered version, I received
the following error message:

    To register these products, please contact Andrey Yastrebov:
        6252 S. Owens Ct. Littleton, CO USA
        E-mail: ledit@aysoft.com
    Sorry, this is an invalid copy of either LEdit DLL or LEdit VCL

What gives?

Answer: The shareware version and registered version of LEdit are not
compatible with each other. In order to prevent problems, we have 
placed checks into the VCL to prevent them from being mixed and matched
with each other. The only way you can get this error is that you have
one of the following two scenarios.
  1) You have the registered VCL installed in Delphi and a shareware
     version of the DLL somewhere in your path.
  2) You have the shareware VCL installed in Delphi and the registered
     version of the DLL somewhere in your path.
These are the only two situations that will give you this error. 

To fix this, you need to check to make sure that you have the registered 
VCL installed. Then you need to make sure that you do not have any other 
copies of the shareware DLL in your path where Delphi may be finding 
them before it finds the registered version of the DLL.

This usually happens when the user installs the registered VCL and has
a shareware copy of the DLL somewhere in the path where Delphi finds
it first. This causes Delphi to crash with the error above. If you just 
find and remove the shareware DLL, or replace it with the registered DLL, 
you should be able to start Delphi back up and everything should be fine. 
If you start Delphi before replacing the DLL, then it will likely give you 
an error saying that there is a problem with your COMPLIB file. This means 
that you did not replace the incompatible DLL that it is finding.

--------------------------------------------------------------------------------

Question: The OnChange event seems to fire both when I move the carat
and when I change the text. How can I tell when the text is changed?

Answer: You can tell when the text is changed from with the OnChange
event by checking the Modified flag. If the Modified flag is set
then the text was changed. If it is not set, then just the carat was
moved.

--------------------------------------------------------------------------------

Question: How do I change color for comments?

Answer: Comments will always have the default color. However you can
change color for everything else and then comments will be shown in
different color.
