Solved

HTML Preview

Posted on 2009-05-06
8
461 Views
Last Modified: 2012-05-06
Hi all,

I have a project where I've inserted a page tab.
On one tab I have a tab with synedit component where I have the html code.

Now I tried adding EmbeddedWB but the preview was not displying properly as it's got css etc.

So, I was thinking of trying TBrowser? or someother if you know of a better component to use.

To basically I have the code on one tab and when I go the tabsheet2 I need to get the browser component to display the html page.

How is the best way to do this please?

thanks

st3vo
0
Comment
Question by:ST3VO
  • 6
  • 2
8 Comments
 
LVL 8

Assisted Solution

by:BdLm
BdLm earned 50 total points
ID: 24312573
use the TWebbrowser , TWebbrowers.navigate(myfile.html)

0
 

Author Comment

by:ST3VO
ID: 24312597
But there's no myfile.html because I type the html code on the synedit component/page and when I change the tab to where the web browser component is I need it to preview my code.

know what I mean?
0
 
LVL 8

Expert Comment

by:BdLm
ID: 24312615
can you access the HTML as a string or stream from synedit ?
here is a complete tutorial on webbrowser
 
http://www.cryer.co.uk/brian/delphi/twebbrowser/twebbrowser_methods.htm 
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:ST3VO
ID: 24312647
Yes you can but it just won't render properly
0
 

Author Comment

by:ST3VO
ID: 24312669
Used this code:

Procedure TfrmMain.PageControl1Change(Sender: TObject);
begin
if PageControl1.ActivePage=Tabsheet2 then
   Begin
 
     LoadFromStrings(SynEdit1.Lines);
   
   end;
end;

It works but doesn't get any css or render properly.

0
 

Author Comment

by:ST3VO
ID: 24312806
OK here's an update:

Please see code below:

It works (well more or less)

There's a problem with is that when I open an external html file into synedit and THEN try to view it on the design view it does not look right at all.

What could be the difference?


procedure TfrmMain.PageControl1Change(Sender: TObject);
begin
if PageControl1.ActivePage=Tabsheet2 then
   Begin
 
   EmbeddedWB1.LoadFromStrings(SynEdit1.Lines);
   
   end;
end;

Open in new window

0
 

Accepted Solution

by:
ST3VO earned 0 total points
ID: 24314651
Fixed it! Had to use absolute path and navigate instead of loadfromstrings
0
 

Author Comment

by:ST3VO
ID: 24314680
Fixed it myself.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
FMX StringGrid1->Canvas->FillRect Problem 3 171
Delphi selector screen 2 84
delphi parse string to params 3 136
Breakpoint doesn't stop in my variable 3 30
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

829 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