Solved

delphi and embeddedwb

Posted on 2014-10-10
7
813 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
  • 4
  • 3
7 Comments
 
LVL 26

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 26

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
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.

 

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 26

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 26

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

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…
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

791 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