LEdit Version 2.01


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.

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

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 V1.01 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 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: FindBrace doesn't seem to work in the VCL, even in your example 
program. How do I make it work?

Answer: This is because of a change we had to make in V1.04 to the 
BraceStyle type. We had to rename all the options to 'br' instead of 
'bs'. We failed to update the example. If you change all the 'bs' 
options to 'br' for BraceType in the example, it should fix the 
problem.

The way to tell if it is working is to right click in the LEdit window, 
bringing up the popup menu. If the cursor is not on a starting brace 
then the 'Find Brace' option will not be available. If the cursor is on
a brace, the 'Find Brace' option on the popup menu will be available. 
If you select it, the cursor will jump to the opposite brace. In the 
Pascal example, the starting brace is the word 'begin' and the ending 
brace is the word 'end' If the cursor is on either of these words, 
then the 'Find Brace' option will be available.

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

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.

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

