FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log inLog in 


drawHTMLinRect

Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog Tips & Samples
View previous topic :: View next topic  
Author Message
Steve Lympany



Horsham, England
Joined: 31 Mar 2001
Posts: 1152

PostPosted: 31 May 2006 16:46    Post subject: drawHTMLinRect Reply with quote

I couldn't find an "HTML renderer" anywhere. CustomIE provided by Gildas is excellent, but I wanted to have several text boxes in a form, and to print them in their correct position, which has entirely different requirements.

So, here is a class that renders basic HTML, and draws it in a rectangle. Printing is also coded.
The class could be extended to create controls such as buttons and checkboxes to allow pretty text (selected words bold, underlined, green etc.), all defined using standard HTML.

There is a slight bug with the wrapping, but it seems OK 99% of the time. I'll update it when I find out what the problem is.

The html tags understood are (but with angled brackets):
{b}bold...
{u}...
{i}...
{li} (list)
{br}
{hr} (horizontal line)
{color="#AA66FF"}

The example has a single form. The drawHTMLinRect is used in a control called "test_control" (this is not printed), but you can also add text boxes just by clicking in "white space" in the form. These boxes can be printed, and you can edit the text in them by double clicking. You can also drag them to new positions.

The main call is:
drawHTMLinRect::hdraw(WW,HTML,RCT,Font)

WW is a domain which passes either the drawwindow + GDI, or a printdocument + GDI. There is a missing predicate in pfc printdocument - you need to add getfont. This simply involves adding two lines - just find setfont in printdocument and repeat them for getfont().

Steve Lympany



html_parser.zip
 Description:
Pretty text defined by standard HTML tags, drawn and printed

Download
 Filename:  html_parser.zip
 Filesize:  31.89 KB
 Downloaded:  1251 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Steve Lympany



Horsham, England
Joined: 31 Mar 2001
Posts: 1152

PostPosted: 4 Jun 2006 17:38    Post subject: Reply with quote

Bugfix

Here is a bugfix. I just attach the package rather than a project.



HTML_parse.zip
 Description:
Package for HTML renderer

Download
 Filename:  HTML_parse.zip
 Filesize:  10.63 KB
 Downloaded:  1206 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Steve Lympany



Horsham, England
Joined: 31 Mar 2001
Posts: 1152

PostPosted: 7 Jul 2006 14:50    Post subject: Reply with quote

Update

The class has been renamed drawHTML

The predicates are now:

drawHTML::drawText() - call similar to vpi::drawText()
drawHTML::drawTextInRect() - call similar to vpi::drawTextInRect()
drawHTML::getTextTextent() - call similar to vpi::getTextTextent()


A small project is attached, which includes printing.



dev_oneHTML.zip
 Description:
HTML rendering. Use simple HTML to have pretty text

Download
 Filename:  dev_oneHTML.zip
 Filesize:  35.68 KB
 Downloaded:  1251 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Steve Lympany



Horsham, England
Joined: 31 Mar 2001
Posts: 1152

PostPosted: 28 May 2010 21:39    Post subject: Reply with quote

Updated for VIP7.3.

Not very sleek, but it works (in general!)

If you need it for Vip7.2, just create a new VIP7.2 project, and copy the project files (.pro, .i etc)

Everyone's welcome to improve it.

Steve Lympany



dev_html_1003.zip
 Description:

Download
 Filename:  dev_html_1003.zip
 Filesize:  63.87 KB
 Downloaded:  754 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Steve Lympany



Horsham, England
Joined: 31 Mar 2001
Posts: 1152

PostPosted: 30 Nov 2010 10:06    Post subject: Reply with quote

Hello

I have done a re-write of this code, and provide it as a DLL. There is an attachment file limit size on this forum, so to download the DLL, please go to:

http://www.acsumama.com/VIPDeveloper/drawHTML.htm

An example executable and manual are also there. Also see:

http://wiki.visual-prolog.com/index.php?title=3rd:HTML_drawer

For other little tools, see:
http://www.acsumama.com/VIPDeveloper/vip_developer.htm

Steve
Back to top
View user's profile Send private message Visit poster's website
Steve Lympany



Horsham, England
Joined: 31 Mar 2001
Posts: 1152

PostPosted: 29 May 2011 21:09    Post subject: Reply with quote

Hi,

Here is an update - DLL version 1.0.0.6. I've added a bit of extra functionality.

http://www.acsumama.com/vip/drawhtml/index.htm

There is a movie (you may have to wait 20 seconds for it to load) so you immediately can see what it does:

http://www.acsumama.com/vip/drawhtml/drawhtmlmovie.htm

Steve
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog Tips & Samples All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum