Solved

delphi and embeddedwb

Posted on 2014-10-10
7
841 Views
Last Modified: 2014-10-18
hi i have chat application that cleint send message and show it to other connected clients in  tmemo  iam done with the application but i decided to change the TMEMO WITH Tembeddedwb  but i dont know how to get it work i found example like this

procedure addChatText(WB: TEmbeddedWB; const html: string;add:integer = 0);
var
   Range: IHTMLTxtRange;
   mText : string;
   ext : string;
   sURL : string;
   i : Integer;
begin
  if not joined then Exit;

  if Not Assigned(Wb.Document) then exit;
  Range := ((WB.Document AS IHTMLDocument2).body AS IHTMLBodyElement).createTextRange;
  Range.Collapse(False) ;

  if add = 1 then
  begin
    if ChatContent <> nil then
    begin
      ChatContent.Add(html+'<BR>');
      mText := ChatContent.Text;
    end else
    begin
      mText := html+'<BR>';
    end;
  end else begin
    mText := html+'<BR>';
  end;

  if ChatContent <> nil then
  begin
    if ChatContent.Count > ChatContentTotal then
    begin
      for i := 0 to 10 do
      begin
        ChatContent.Delete(0);
      end;
    end;
//   while (ChatContent.Count) > ChatContentTotal do ChatContent.Delete(0);
  end;
end;{ * chatPMAppend *}

Open in new window



but that doesn't work in delphi xe5 i did not recive any message that i sent

i send message like this

addChatText(weblog,'<span class="Name">'+Name+':</span> '+ message,1);

Open in new window


Note : Weblog is my  Tembeddedwb .
0
Comment
Question by:drama22
[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
  • 4
  • 3
7 Comments
 
LVL 27

Expert Comment

by:Sinisa Vuk
ID: 40375863
TEmbeddedWB is a quite large - try use smaller HtmlViewer component. You need to be sure what you post o ewb/html viewer. Try save to file first as html file and try to open in common web browser. Sometimes you need to have common html header at top...
0
 

Author Comment

by:drama22
ID: 40375887
Html viewer can show embedded youtube videos ? If yes can I have sample code of how client message can be showing after they send it ,, I know its sounds very odd but iam very beginner to understand everybthing without code sample .
0
 
LVL 27

Accepted Solution

by:
Sinisa Vuk earned 500 total points
ID: 40383742
I downloaded TEmbeddedWB from Torry.net
In a package in Demo section is example of how to use additional TEditDesigner component with TEmbededWb. Purpose is something like chat like editor and can produce html text to send.

Connect EditDesigner1 with Ewb component and load chat text like this:
  if EditDesigner1.ConnectDesigner = S_OK then
  begin
     EmbeddedWB1.LoadFromString(html_text);
  end;

Open in new window


without EditDesigner Ewb is just a html viewer.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:drama22
ID: 40384413
that not what i need i test it before  not doing the job the code above that i post in my main question would be helpful if some fixes added but thats not solve for the main need ..
0
 
LVL 27

Expert Comment

by:Sinisa Vuk
ID: 40386761
Grab html encoded text form one user and send to another (code in older question) (from one ewb to another ewb)
0
 

Author Comment

by:drama22
ID: 40388639
Better yet xan I grab the messages from tmemo and show it in embeddedwb ?
0
 
LVL 27

Expert Comment

by:Sinisa Vuk
ID: 40388827
like this:
if EditDesigner1.ConnectDesigner = S_OK then
  begin
     EmbeddedWB1.LoadFromStrings(Memo1.Lines);
  end;

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

752 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