Monthly Archives: October 2004

Delphi 2005: Revisiting the Welcome Page


Click to enlarge

In C#Builder 1.0 and now Delphi 8.0 the IDE has a Welcome page which is little more than Microsoft‘s WebBrowser control hosted by the IDE pointing to a rather static HTML page.  In it’s current incarnation the Welcome page is rather lacking but with a little creativity we can begin to unlock its potential.  Throughout the development of C#Builder and D8 for that matter, there were many discussions with some really good ideas (and a few bad ones too 🙂 as to what should appear on the Welcome page but unfortunately by the time RTM rolled around hardly anything that was discussed had actually been implemented.  Since I work on the Internet features of the IDE and particularly the HTML/ASP.NET designers it was particularly frustrating to know the potential of the Welcome page and that we hadn’t even scratched the surface.

Scratching the Surface

During the development of Delphi 2005 I decided that it was time to revamp the Welcome page.  Once again I heard similar mumblings about how to improve it and I finally decided it was time to act (I hadn’t worked on the Welcome page in either D8 or C#B).  To that end I made a list (not necessarily in this order) of things I’d like to see on the Welcome page:

  1. Have a familiar look-and-feel comparable to many modern websites
  2. Provide dynamic content that’s relevant to the developer audience
  3. Provide extensibility allowing customers to tailor the Welcome page to fit their needs
  4. Provide a good example of XHTML layed out using CSS

The first task was to review the current files that make up the existing Welcome page and see what I could use and what would need to be changed.  The layout that I had in mind was similar to many existing websites with a banner, a menu, the main content and a footer which the current design had two, the banner and the footer.  I shuffled the HTML around and built the structure of the page that I felt met these requirements.  Next, I started on the problem of dynamic content and how to keep the Welcome page fresh with new content but without requiring an entirely new infrastruture like Delphi Direct.

Enter RSS, XML and Javascript

Given the current popularity of RSS and the plentiful list of feeds provided by the BDN the decision of what content to include was pretty easy the hard part, or so I thought, would be getting the content onto the page without requiring that that IDE do all the work.  RSS is a defined XML format and the easiest way to programatically work with XML is via a DOM which is easily accessible from Javascript.  At first, I tried to create an implementation that wouldn’t require too much of my time because I still had obligations for the HTML/ASP.NET designer.  What I came up with was a page listed the items from a single RSS feed (not to mention the recent projects table and a list of static links) but as it turns out this was just the beginning.

In the end, we created a Welcome page where the content is driven from XML files including the list of links and the available RSS feeds.  Out of the box you will be able to choose from a list of 45 different RSS feeds from a dropdown right on the page.

Leveraging the Welcome Page for Your Team

Internally, we’ve setup our own development blog server where anyone on the team can blog about internal issues,  announce new features as they show up in the product and notify the rest of the team about any potential problems.  Basically, the Welcome page has become a way for us to improve communication throughout our entire team.  You too can take advantage of this feature by setting up an RSS feed of your own and editing an entry in defaultProviders.xml located in .\welcomepage\xml under your Delphi 2005 directory.

I hope people find Welcome page 2.0 🙂 a lot better and I look forward to see where we can go from here!  Send me a comment and let me know how you like or dislike it.

Finally, I’d like to thank Daniel Wischnewski of the The German Delphi Community for all his help.  Thanks Daniel!

Diamondback (Delphi 2005) and "live" data at design time on an ASP.NET WebForm

If you haven’t already seen our DBWeb controls I highly recommend taking a look at them once Diamondback hits the streets. Our DBWeb controls are a set of data aware ASP.NET controls that allow you to not only manipulate data at runtime but also view the data on your WebForm at design time. If you haven’t played much with ASP.NET you might ask “why is that a big deal?” since design-time data has long been available in the VCL form designer. Well, for starters when Microsoft shipped ASP.NET (1.0 and 1.1) their data aware controls required (and still do btw) data binding code before they will render any content which means they only render content at runtime.

For example, when you drop down an you see that it comes prepopulated with some fake data and that’s all your ever going to see at design time. In a DBWeb control, once you connect it to an active data source you’ll immediately see the data in the ASP.NET designer just like you see data in the VCL forms designer. Again, you might be saying to yourself “that’s really no big deal I don’t need to see the actual data”. Well, picuture this you have a grid that once it’s populated with data is going to run right off the righthand edge of the page you’ve spent so long making look really nice. Wouldn’t you rather discover that as soon as you hook up the control rather than having to run the application for each and every control you add to the page to just to see how the control will morph when it contains data?

We first introduced our DBWeb controls in C#Builder and in Diamondback we’ve continued to improve them and add additional controls for things like sound and multimedia content. Additionally, you can feed the controls data from an XML file so it’s easy to quickly prototype a data driven web site without even having to setup a database.

HTML Tidy should support ASP.NET here's how you can help

Back when I was working on BorlandC#Builder I made the decision
to incorporate the W3C’s HTML
Tidy
formatting tool directly into the IDE.  It has lots of options and
does a nice job of formatting and correcting errors.  There are several ways to
leverage HTML Tidy in the IDE, for example when editing an HTML file from the
code editor you can select Edit | HTML Tidy | Format Document or Edit | HTML
Tidy | Check Document for Errors.  Additionally, you can also select to use HTML
Tidy as the default HTML formatter for both HTML and ASP.NET pages.  What isn’t obvious is that we had
to do a tremendous amount of work to get HTML Tidy to play well with ASP.NET
controls but even with all the work we did it still won’t format certain ASP.NET
controls correctly. 

Since ASP.NET tags are not part of the HTML specification it is necessary to
provide Tidy with a list of new tags and how they should be formatted.  Tidy has
several options allowing you to control how new tags are formatted using
either block, inline, empty or pre.  In C#Builder and Delphi 8.0 we automatically discover
any ASP.NET tags within an .aspx page and prepopulate these settings prior to
formatting allowing Tidy to format the ASP.NET tags as it would any standard
tag.  There are lots of ASP.NET tags and subtags and without this feature it
would be incredibly tedious to try and use HTML Tidy to format ASP.NET
pages.

One problem however is that some ASP.NET
tags support templates
, meaning that they can contain fragments of HTML
which should not be modified during the formatting process.  Unfortunately, HTML
Tidy has no way to deal with ASP.NET templates and will in fact reformat the tag
and completely change it’s meaning.  As you can imagine this is not a good
situation and unfortunately there is no workaround.

HTML Tidy does provide support for various web scripting languages like PHP
and ASP and I think as the popularity of ASP.NET grows that it would be great
if HTML Tidy could provide support for it too.  If the support can’t be built
into HTML Tidy then there needs to be some alternative whether it’s a callback
or some other mechanism that would allow the developer to improve Tidy’s ability
to deal with tags that it’s not familiar with.

Over the past year and a half I’ve have seen a handful of requests for Tidy
to support ASP.NET but unless more people speak up and voice their opinion I’m
afraid it will be a long time before that will happen.

Here’s where you come in, if you’d like to see this situation improve please
visit the HTML Tidy website, get
involved either by asking the great set of developers who keep this code base
alive to support ASP.NET or by grabbing the code, diving in and adding it
yourself (of course read all of the guidelines before doing that).

While you’re there also make a case for separating how HTML Tidy options are
passed so that things like the Borland IDE’s aren’t tied to the Tidy config file
format.  I’d really like to see the command like option handling separated so
that IDE’s can load options from whereever they store them whether it’s the
Windows registry or an INI file or whatever.

A few other notes, I’d like to thank the people who work on HTML Tidy for all
of their effort.  They do a great job and have been very helpful and responsive
whenever I’ve had questions.  Additionally, I’d also like to point out that we
used Jeffrey
Pohlmeyer’s TidyPas Pascal interface
.  Btw, both of these are mentioned in
our IDE’s Help | About box.

[Updated Dec 29 2004] Added link with additional information
on ASP.NET page templates.
[Updated March 29, 2005] Just got a comment from Jeff
updating the link to Tidypas which I’ve now corrected in this post.

Next Up: Diamondback (Delphi 2005) and Formatting ASP.NET/HTML

To start off I’d like to address the issue of why we need a formatter at all. Our ASP.NET/HTML designer leverages the MSHTML control as its design surface and as a result we have to deal with the fact that this control discards any/all formatting including whitespace preservation when working with HTML. If you’d actually like to see the effect of using MSHTML without a formatter (trust me you won’t be happy) simply rename htmlfmt80.bpl in your Delphi 8 bin directory, start the IDE and answer Yes to the “continue to load this package” error and start editing an HTML file. This package contains our HTML formatter and without it you simply get back the raw HTML from the MSHTML control.

One decision we made in Delphi 8 was to format only the content of the file starting after the first tag. There were several reasons we did this but the main reason was that we wanted to format as little of the file as possible and since many pages have sections that contain stylesheet and scripting information we thought this would be a good idea. As it turns out this wasn’t a very good idea and in some cases can result in HTML being either mangled or duplicated neither of which is good. It is possible in Delphi 8 to undo the changes made in the designer using Edit|Undo but that’s not always acceptible either.

In Diamondback we’ve completely fixed this problem and not only improved our formatter but also have relaxed the rules for creating non-HTML documents using the ASP.NET designer. For example, if you want to create an ASPX page that returns only XML (like an RSS feed) simply start a new ASP.NET page and delete all of the contents except the @ page directive at the top of the file then start adding your markup and the designer won’t mess it by trying to turn it into an HTML page. As a side note, we’ve continued to monitor the progress of the W3C’s HTML Tidy open source project and have worked to keep our libtidy.dll up-to-date.

Next Up: Extensible ASP.NET Code Completion for 3rd Parties

Diamondback, like Delphi 8, supports code completion on ASP.NET server controls from within the code editor as well as the tag editor.  This makes working with ASP.NET tags much easier and helps prevent mistyping tag and attibute names helping keep your development time productive.  In Diamondback we’ve changed the loading of schema files that describe ASP.NET server controls such that third party companies that produce ASP.NET controls and make their controls work like first class citizens in the Diamondback IDE with full support for code completion and HTML Error Insight (a topic for another day).

To take advantage of this feature all you have to do is create a .xsd file that looks like the ones provided with Diamondback and place it in the “..\schemas\asp schemas” under your Diamondback root directory.  When the IDE starts it loads all of the schemas from that directory for use with various IDE features like code completion.  If you are a vendor who already has a schema file for VS.NET then typically just dropping that file into the above directory will add first class support to the Diamondback IDE.

[UPDATE: Dec 8, 2004]  I just debugged a problem with the support for third parties supplying .xsd files for use with ASP.NET code completion.  The IDE currently only supports “asp” and “borland” namespaces.  We’ll be looking to fix this issue in a future update.

Next Up: Diamondback (Delphi 2005) and ASP.NET Template Editing

In continuing my posts on new ASP.NET features in Diamondback today I’ll mention ASP.NET template editing. Several ASP.NET controls support what are called templates which are small fragments of Text/HTML that the control uses are runtime. Controls that support templates like or template columns within a require a special template editing mode necessary to edit the template in the WebForm designer. Basically, template editing is a special sub-edit mode of the control used within the ASP.NET WebForm designer, something that wasn’t supported in Delphi 8.0 but fully supported in Diamondback. In Delphi 8, you can use the code editor to manually edit control templates and in Diamondback you’ll be able to use the template editor right within the WebForm designer which supports drag/drop and direct editing of the template. Additionally, with the tag editor, the small edit window at the bottom of the WebForm designer, you can immediately see the code within your templates which is a feature unique to Diamondback. Template editing is one of the many improvements to ASP.NET development we’ll be delivering in Diamondback.

Firefox just keeps getting better

Now that the 1.0 preview release of Firefox is out I just gotta say again how
nice it is to have a browser that keeps getting better and better.  Some of the
new features that I really like are incremental search and the highlighting of
the address bar when you browse to a secure site.  Firefox has really made me
look forward to getting each new release.  My thanks go out to everyone who
works to make Firefox the great application that it is today.