Enhancing Web.PB with the Starfire Class Library

by Don Draper

Page 2

One feature I like is the ability to create a simple form with data directly from a datawindow. A single function named f_GenerateHTMLForm() does this much like the one now available in PowerBuilder 6.0. This is great if all you need are forms generated for your datawindow.

Here is a brief list of features provided by the Starfire library.

  • Datawindow HTML form conversion

  • Fully updatable HTML forms

  • No plug-ins or ActiveX controls needed....a true thin client solution.

  • Works with Microsoft Internet Explorer and Netscape Navigator

  • Automatic javascript generation

  • Master-Detail support

  • Easily customisable with few function calls

  • Free for downloading!


Is Starfire for you?

So, is this library going to save you thousands of hours of work? Should you download it now and use it in your next Web.PB application? Well, you definitely should get it and take a look. It would take you forever to rewrite the features this library provides. Plus, you can’t beat the current price of free.

As with every product, there are always some drawbacks. You may find that Starfire is still not going work for you immediately. Why? First of all, it must execute a lot of code to perform all of this work. Unfortunately, this makes it relatively slow. While slow is a relative term, it will always be slower compared to techniques that require more manual coding effort up front but result in a leaner, faster implementation at run-time for the end-user. I did not try the library as a machine coded executable and I suspect this would boost performance as it does with most libraries.

Second, the appearance of the forms created by Starfire may not meet your expectations as displayed in some browsers. Specifically, the labels and controls don’t always line up vertically as you might expect.

In HTML forms prior to Dynamic HTML, the common way to align fields in a form is to place the labels and fields in columns of an invisible table. Starfire wraps each “row” of objects in separate HTML tables instead of using a single table. This permits it to create an HTML form that is a more accurate rendition of the original datawindow.

However, if you prefer to have labels and fields line up vertically in your HTML form, then this may be more difficult to achieve. Had they chosen to wrap all of the objects in a single table, the vertical alignment could be much better. Unfortunately, this makes rendering the datawindow in HTML less accurate if objects do not line up vertically. Also, this requires you to vertically and horizontally align all objects in your datawindow first so that the code can determine which table column the object should be placed in. This is the case using the GenerateHTMLForm() function available in PowerBuilder 6.0.

This issue is a result of HTML pages not having exact x and y co-ordinates to place objects, not a fault of Starfire. The good news is that HTML is getting better. Both Microsoft and Netscape version 4.0 browsers provide some support for Dynamic HTML (DHTML) that improves page design and functionality. Soon, it will be common to place objects on an HTML page in any exact location.

Room for Improvement?

I really hope that STEP Consulting will continue to improve this wonderful library. Although the library might be the best tool around for Web.PB developers, I wanted to dig down deep and see if I could find areas that could be improved. I was only able to find some minor issues and I really had to look hard.

The most prominent issue I found was that Starfire re-retrieves all drop-down datawindows (dddw). Yikes! When a datawindow is retrieved, dddw’s are also retrieved as long as they don’t already contain data. However, Starfire re-retrieves each one as a regular datawindow.

You can easily bypass this redundant retrieve by getting a handle to the dddw via GetChild() and then passing this argument to subsequent functions. Next, change affected function arguments from datastore to datawindowchild and remove the unnecessary Retrieve() call. The performance increase will really be noticeable when many dropdown datawindows are used. The Starfire developers assured me this would be corrected in future versions.

Other minor speed enhancements would include removing expensive function calls from loops.  For examples you might see..

FOR x = 1 TO UpperBound(array)

As for me, I have taken some of their code, fine tuned it for my needs and now have the ability to create forms from datawindows very quickly. Of course I still perform substantial up-front coding and retained only a tiny bit of functionality of the Starfire product. Many developers will use Starfire as is and others will enhance it to suit their needs.

 

 
Next Page of this article...