• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

DHTMLEdit Paragpraph

How to change paragraph in DHTMLEdit as is in FrontPage ?

Paragraph
  Indentation
    BeforeText
    AfterText
    IndentFirstLine
  Spacing
    Before
    After
    Word
    LineSpacing

Thanks.
0
zuipo
Asked:
zuipo
1 Solution
 
intheCommented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now