Solved

delphi and embeddedwb

Posted on 2014-10-10
7
761 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 25

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 25

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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 25

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 25

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now