Solved

DHTMLEdit Paragpraph

Posted on 2002-05-12
1
277 Views
Last Modified: 2010-04-04
How to change paragraph in DHTMLEdit as is in FrontPage ?

Paragraph
  Indentation
    BeforeText
    AfterText
    IndentFirstLine
  Spacing
    Before
    After
    Word
    LineSpacing

Thanks.
0
Comment
Question by:zuipo
1 Comment
 
LVL 17

Accepted Solution

by:
inthe earned 400 total points
ID: 7004594
hi,
is this what your after:

If you press Shift+Enter you get a <BR> instead of a <P>, so here is an example of how to do that automatically when you press enter.

FShiftKeyIsDownBaby : Boolean
FShiftKeyIsDownBaby  := False;
.....

procedure TFormNewMessage.DHTMLEditonkeydown(Sender: TObject);
begin
if DHTMLEdit.DOM.parentWindow.event.keyCode = VK_RETURN then
  begin
    if FShiftKeyIsDownBaby = False then
    begin
      DHTMLEdit.DOM.parentWindow.event.returnvalue := false;  {ignore this
key}
      KEYBD_EVENT(VK_SHIFT, MapVirtualKey(VK_SHIFT,0),0 ,0);    {set shift
on}
      KEYBD_EVENT(VK_RETURN, MapVirtualKey(VK_RETURN,0),0,0);   {and resend
return}
      FShiftKeyIsDownBaby := True;
    end;
  end
  else
  if FShiftKeyIsDownBaby then
    DHTMLEdit.DOM.parentWindow.event.returnvalue := false;  {ignore any
extra keys while shift is down}
end;

procedure TFormNewMessage.DHTMLEditonkeyup(Sender: TObject);
begin
  if FShiftKeyIsDownBaby then
  begin
    KEYBD_EVENT(VK_SHIFT, MapVirtualKey(VK_SHIFT,0),KEYEVENTF_KEYUP,0);
{turn off shift key}
    FShiftKeyIsDownBaby := False;
  end;
end;



ps,
you can do indents, outdents,bullet lists etc like:

var
p : olevariant;

dhtmledit1.ExecCommand(DECMD_INDENT,OLECMDEXECOPT_DONTPROMPTUSER,p);

just change the DECMD_INDENT const to one you want to use

0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question