Solved

Carriage return without paragraph (Webbrowser)

Posted on 2002-06-14
4
408 Views
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?

Smilly
0
Comment
Question by:Smilly
[X]
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
4 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 200 total points
ID: 7080126
hi,
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);
begin
if DHTMLEdit.DOM.parentWindow.event.keyCode = VK_RETURN then
 begin
   if FShiftKeyIsDown = False then
   begin
     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;
   end;
 end
 else
 if FShiftKeyIsDown then
   DHTMLEdit.DOM.parentWindow.event.returnvalue := false;  
end;

procedure TFormNewMessage.DHTMLEditonkeyup(Sender: TObject);
begin
 if FShiftKeyIsDown then
 begin
   KEYBD_EVENT(VK_SHIFT, MapVirtualKey(VK_SHIFT,0),KEYEVENTF_KEYUP,0);
   FShiftKeyIsDown := False;
 end;
end;

does that help?

Regards Barry
0
 
LVL 1

Author Comment

by:Smilly
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.

Smilly
0
 
LVL 17

Expert Comment

by:inthe
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."
0
 
LVL 1

Author Comment

by:Smilly
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


Smilly
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

617 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