Carriage return without paragraph (Webbrowser)

Posted on 2002-06-14
Last Modified: 2010-05-18
I have a webbrowser on my form, wich is in design mode, and when I press the return button, it makes a double line break instead of a single one, except when I press  Shift+return.

How can I get the webbrowser to do a <br> instead of <p> in the HTML code when the user press the return button?

Question by:Smilly
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 17

Accepted Solution

inthe earned 200 total points
ID: 7080126
webbrowser in design mode?im guessing your using dhtmledit or pagedesigner

well this is standard behavior as in ms frontpage etc but you can workaround it like:

global vars:

FShiftKeyIsDown : Boolean
FShiftKeyIsDown  := False;

procedure TFormNewMessage.DHTMLEditonkeydown(Sender: TObject);
if DHTMLEdit.DOM.parentWindow.event.keyCode = VK_RETURN then
   if FShiftKeyIsDown = False then
     DHTMLEdit.DOM.parentWindow.event.returnvalue := false;  
     KEYBD_EVENT(VK_SHIFT, MapVirtualKey(VK_SHIFT,0),0 ,0);  
     KEYBD_EVENT(VK_RETURN, MapVirtualKey(VK_RETURN,0),0,0);  
     FShiftKeyIsDown := True;
 if FShiftKeyIsDown then
   DHTMLEdit.DOM.parentWindow.event.returnvalue := false;  

procedure TFormNewMessage.DHTMLEditonkeyup(Sender: TObject);
 if FShiftKeyIsDown then
   FShiftKeyIsDown := False;

does that help?

Regards Barry

Author Comment

ID: 7080185
Hi Barry

Thanks it works, but now I have a problem the other way around, now I can't make <p> tags, and when I using "InsertOrderedList" it goes for all the text in the document.
How can I make shift+return do a <p>, means that I have switch the return <--> shift+return.

LVL 17

Expert Comment

ID: 7081149
ill try to make a working example of using shift - return for paragraph later today,are you using DHTMLEdit ?
ill just need to add a FCTRLKeyIsDown check in the above routine

not sure what you mean here:
"I using "InsertOrderedList" it goes for all the text in the document."

Author Comment

ID: 7081895
Hi Inthe

I'm using MSHTML, and it would be very nice if you could come up with something, but anyway the points is yours.

What I meant was, when I make a line "Bullet" like this

 .bullet line 1
 .bullet line 2
 .bullet line 3

then instead of doing a bullet on every single lines it does a bullet on the hole text, like this:

 .bullet line 1
  bullet line 2
  bullet line 3


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 74
how to change, disabled button color FMX ? 1 64
MS Access from Delphi 31 100
shape, triangle, dbctrlgrid 3 46
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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