YOUR FEEDBACK
Two great PDF creators
Michael Jahn wrote: related to the snapscan - are their an samples of the ...
SOA World Conference
Virtualization Conference
$50 Savings Expire May 23, 2008... – Register Today!


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
POWERBUILDER LINKS YOU MUST CLICK ON


New Rich TextEdit Control for PowerBuilder 10.5
A much-needed improvement

Digg This!

Page 1 of 2   next page »

One new long-anticipated feature of PowerBuilder 10.5 was originally planned for the PowerBuilder 10.0 release: the new Rich Text Edit (RTE) control. The original RTE control (see Figure 1) was introduced into PowerBuilder before Microsoft implemented a Rich Edit Control within the Windows Common Controls. Since there wasn't a "standard" rich edit control in the operating system, many developers were using third-party controls to implement such functionality. In addition, at that point, cross-platform availability was a requirement, since PowerBuilder was available for development on Mac and UNIX platforms. One of the most popular third-party controls was called HighEdit, and the original PowerBuilder RTE control was an OEM version of that control.

Some time after the original PowerBuilder RTE control was introduced, the original vendor of the control not only discontinued support for it, they exited the third-party control market entirely. As a result, the functionality of the control was largely frozen, while at the same time the expectations that users had for the functionality of such a control continued to evolve and expand. In particular, the look and feel of Windows applications has changed over time and the Rich Text Format (RTF) standard for the text the controls should work with has been updated several times since. As the years went by, the original control became more and more dated.

That has all changed with the introduction of a new RTE control in PowerBuilder 10.5 (see Figure 2). Rather than introducing a second RTE control and continuing to support the original RTE control for backward compatibility, Sybase has instead chosen to replace the original RTE control with the new one. The idea was to provide as much backward compatibility for the old control as possible, and yet also provide much more support for the newer features that end users are expecting.

The use of the RTE has typically fallen into three categories:

  • Load rich text data from either files or the database, maybe allow editing, and maybe allow saving of the data to either file or database
  • Data entry from an empty control
  • Programmatic data population of the control
Let's look at the new features that affect each category.

Loading and Saving
The obvious change you'll see first in loading rich text documents is the fact that more rich text features, like tables, are loaded successfully. While this does not support 100% of the features found in Word's rich text export, you'll find most of the features your users will expect as basic word processing functionality. One way the new control imports more elegantly is the manner in which it deals with features in the imported files that are not supported. In the old RTE control, unsupported features often showed in the control as uninterpreted rich text code or some other meaningless code. In the new control, the unsupported features are cleanly stripped out. This makes for a much less confusing experience for the user.

Users loading rich text had to convert their documents from some other format to rich text. This step may be eliminated in the future for many with the addition of import support for Microsoft Word (DOC) files and HTML files. In some random testing, we've had varying success loading HTML files, particularly showing problems loading graphics from other directories. Still, this could become a relatively easy way to load basically formatted text into the RTE control. Word document loading was much more successful. Word documents imported natively preserved the format better than the same documents exported from Word as rich text, and then rich text imported to the RTE control. Similar to rich text import, features that aren't supported by the control are stripped out.

Not only does the new control load new document types, it also jacks up the number of picture formats it supports from one to six. The old rich text control handled only BMPs. The new control can load:

    •    BMP
    •    WMF
    •    TIFF
    •    JPEG
    •    PNG
    •    GIF

While this doesn't add a new file format support to PowerBuilder overall, this means the RichTextEdit edges out the InkPicture control as the control with the most number of supported picture formats.

Saving from the RTE control has also been beefed up. The old control could save its contents as plain text or rich text. The new control adds HTML, Word DOC, and Acrobat PDF to the mix. The Acrobat document generation is done internally without Ghostscript, easing the stress some people had about deploying Ghostscript. These saving options open up a whole new realm of document-generation options for applications.

One of our first inspirations when we heard about the new import/export options was around the DataWindow. The DataWindow can export HTML. The RTE control can import HTML, then export PDF. Could this be a new solution for PDF deployment without Ghostsciprt? Unfortunately our testing only produced respect for the DataWindow print engine and for the difficulty involved in loading HTML. While the concept looked good on paper, in reality it fell short. The new RTE control had problems properly identifying the correct border type to apply to the tables that are used extensively to handle text positioning (the RTE control created visible borders instead of invisible), and HTML documents wider than the page don't produce the horizontal page break that the DataWindow handles so elegantly.

Data Entry
When providing the RTE control for data entry, the first thing your user will recognize is the new look. Gone are the Win3.1-style toolbar; it's replaced with one that looks more up to date. In addition, a status bar that is common in so many applications is now available along the lower edge of the control. Of course, both can be turned on and off with simple attributes, either in the painter or at runtime.

The Properties pane for the new RTE control has a new Font tab page (see Figure 3) in which you can set the default font face, size, and style for the control. Previously it was somewhat ironic that the only PowerBuilder control with a text attribute that you couldn't set the default font face and size for was the RTE control. There were some workarounds for this, but they involved calling some officially unsupported native methods of the underlying third-party control. Finally, with this new control, that long-standing issue has been resolved.

Still more functionality becomes available when you consider that since Microsoft standardized the API for rich edit controls when it introduced them into their own custom controls, a third-party market has developed for tools that interact using that API. Since the new RTE control largely implements that API, there are a number of utilities out there that can be used to extend the functionality of the control.

Probably of most interest is the addition of a spell-checking capability for the control. Because the original control didn't support the rich text control API, spell checking with it usually involved extracting the non-RTF text from the control and spell checking it. This would usually result in a loss of formatting of the text. Now that the new controls support the API, spell checking becomes a possibility, even to the extent of auto spell checking (where the spell checking is done as you type in the control).

We'll look at implementing spell checking using three different add-on spell checkers:

The way all of these utilities work is by accessing the control through its Windows handle, which you have to pass to them. The trick is that you need to pass in the handle of the rich text edit portion of the control. The RTE control is actually a composite of several controls: the rich text edit area, the status bar, the ruler bar, and the tab bar. We're going to use a Windows spy utility (see Figure 4) to get the class names for the individual controls and their wrappers, so we can navigate down via some Windows API call to get the correct handle.

The window with a title of "RTF Control" and a class name of "FNWDN3105" is the parent window that we've put the control on. The class with no title and the class name of "PBRTC105" is the RTE control itself. You can then see that it's made up of the PBTxtButtonBar, PBTxRuler, PBTxStatusBar and PBTxTextControl controls. And finally, within the PBTxTextControl class is an AfxOleControl42u class object, and within that is the TX11P class object that we're really interested in.

Each of these spelling controls is an ActiveX, so what we created a custom user object for each type olecustomcontrol to serve as a reusable wrapper for them and associated the custom user object with each ActiveX. Then we declared the following local external function in each:

Protected Function ulong FindWindowEx( ulong hwndParent, ulong hwndChildAfter, string
lpszClass, long lpszWindow ) LIBRARY "user32.dll" ALIAS FOR "FindWindowExW"


Page 1 of 2   next page »

About Bruce Armstrong
Bruce Armstrong is a development lead with Integrated Data Services (www.get-integrated.com). A member of TeamSybase, he has been using PowerBuilder since version 1.0.B. He was a contributing author to SYS-CON's PowerBuilder 4.0 Secrets of the Masters and the editor of SAMs' PowerBuilder 9: Advanced Client/Server Development.

About Terry Voth
Terry Voth, an independent consultant, has worked with PowerBuilder for over 10 years, and in the computer industry for over 15 years. He has extensive experience in both the public and private sectors, primarily in Ontario, Canada.

SYS-CON Italy News Desk wrote: One new long-anticipated feature of PowerBuilder 10.5 was originally planned for the PowerBuilder 10.0 release: the new Rich Text Edit (RTE) control. The original RTE control (see Figure 1) was introduced into PowerBuilder before Microsoft implemented a Rich Edit Control within the Windows Common Controls. Since there wasn't a 'standard' rich edit control in the operating system, many developers were using third-party controls to implement such functionality. In addition, at that point, cross-platform availability was a requirement, since PowerBuilder was available for development on Mac and UNIX platforms. One of the most popular third-party controls was called HighEdit, and the original PowerBuilder RTE control was an OEM version of that control.
read & respond »
PBDJ LATEST STORIES . . .
3rd International Virtualization Conference & Expo: Themes & Topics
From Application Virtualization to Xen, a round-up of the virtualization themes & topics being discussed in NYC June 23-24, 2008 by the world-class speaker faculty at the 3rd International Virtualization Conference & Expo being held by SYS-CON Events in The Roosevelt Hotel, in midtown
The PB Future: More on Graphs in PowerBuilder 11.5
Last week I posted a screen shot of the new 3D Rendering capabilities being added to some of the 3D graphs in PowerBuilder 11.5. It was met with mixed reviews on the PowerBuilder Futures newsgroup (forums.sybase.com) so I went back to the drawing board to see what I could come up with.
BluePhoenix Expands Modernization Collaboration with Microsoft
BluePhoenix announced that it has expanded its collaboration with Microsoft on legacy modernization projects. The collaboration provides customers moving their applications or databases to .NET-based environments the best in both modernization services and technical support. BluePhoeni
Sybase PowerBuilder Delivers AJAX and .NET Enhancements Enabling Rich Internet Application Development
Sybase announced that AJAX development capabilities and further Microsoft .NET enhancements have been added to the latest version of Sybase PowerBuilder 11, the premier 4GL rapid application development (RAD) tool. PowerBuilder 11.2 represents another milestone in the PowerBuilder road
PowerBuilder 11.2 Released: Sybase's Flagship IDE
Sybase has released the production version of its flagship .NET development tool - PowerBuilder version 11.2. This latest release of its premier IDE for RAD includes not only standard fixes but also a good list of new features. Here is the 'Coles Notes' version of these new features.
PowerBuilder Takes You To .NET
In June of 2007, Sybase released PowerBuilder 11. PowerBuilder developers can now deploy PowerBuilder components as .NET Assemblies or as .NET Web Services. A PowerBuilder developer can now create these .NET resources so that those who develop .NET solutions can benefit from PowerBuild
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE
BREAKING POWERBUILDER / SYBASE NEWS
Sybase and Sun Set Guinness World Record for World's Largest Data Warehouse
Sybase, Inc. (NYSE:SY), the largest enterprise software and services company exclusively