YOUR FEEDBACK
Gregor Rosenauer wrote: well, not what's your take on this? Did I miss a second page of this article or...
AJAXWorld RIA Conference
Early Bird Savings Expire Friday Register Today and SAVE !..


2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
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

The FindWindowEx function searches for a child of the window represented by the hwndParent handle, beginning after the child window represented by hwndChildAfter, whose class name is lpszClass. The lpszWindow argument can be used to pass in a string with a window title. We won't be using it, so we've declared it as long instead and will be passing 0, which passes a null to the function so that all window titles (or none at all) are matched. I'll also be passing a 0 for the hwndChildAfter to tell the function to start its search with the first child window.

For the function that we created on those custom user objects to tell them to spell check the text in the RTE, we pass in an object of type richtextedit (the parent PB control). Within that function, we use the following logic to get the handle of the internal rich edit area:

ulong       hWin

hWin = Handle ( a_rte )
hWin = FindWindowEx ( hWin, 0, "PBTxTextControl", 0 )
hWin = FindWindowEx ( hWin, 0, "AfxOleControl42u", 0 )
hWin = FindWindowEx ( hWin, 0, "TX11P", 0 )

The last value of hWin is passed in as the parent in the subsequent call because these classes are actually nested within each other.

Beyond this point, the way the spell checking is implemented is entirely dependant on which utility we are using. The JRSpell requires a bit of set up in the constructor event to set the language used and the location of the dictionary file (see Listing 1). The VSSpell only requires a reference to the dictionary file:

this.object.MainDictFile = "VSSP_AE.DCT"

and the WSpell didn't require any setup code at all. For the JRSpell utility, the spell check is initiated through the SpellCheckWithDialog function:

this.object.SpellCheckWithDialog ( hWin, 0, 3 )

where the handle to the rich edit area is passed in (hWin) along with the start position (0 to start at the beginning) and the user object type (3 meaning TX Text Control). For VSSpell, the spell checking is initiated through the CheckWindow function:

this.object.CheckWindow ( hWin )

where the handle to the rich edit area is passed in (hWin). For the WSpell utility, we set a few properties (including assigning one the handle of the rich edit area) before we call the Start function (see Listing 2). Finally, the WSpell and VSSpell utility will automatically replace a misspelled word with the correction selected by the user. However, the JRSpell utility calls only a changeword event on the spell-checking control, passing in the replacement word. The developer has to do the actual replacement of the text. Fortunately, that's easily accomplished by calling the ReplaceText function on the PowerBuilder RTE control:

i_rte.ReplaceText ( newword )

Automated Data Fill
This new control updates rich text support from "a subset of the 1.2 specification" to "a subset of the 1.6 specification." While the specifics of "what is the subset" isn't defined, one thing this upgrade has added that was sorely missing was support for tables. Now, for example, we can create tables of rows of data and include that within a generated letter. The primary downside of the table support is that there isn't a means in the RTE toolbar for the user to add tables, so you'll have to create your own PowerScript to PasteRTF() a table into the control. To give you a headstart on building a basic routine, we've included a sample with some presumptions, such as table width and border type (see Listing 3).

Other features now supported include:

  • Double underline
  • Paragraph shading
  • Paragraph borders
  • Headers/Footers
Caveats
Sybase has gone to great lengths to maximize compatibility with the previous RTE control, including rejecting use of the Windows standard RTE control. Doing so put off the upgrade of the RTE control originally planned for PowerBuilder 10.0, risking the wrath of us, the PowerBuilder user community. Obviously, compatibility was important. While important, it wasn't 100% achieved. Our opinion would be that documented incompatibilities aren't significant. For example, ReturnsVisible, SpacesVisible, and TabsVisible have all been replaced by ControlCharsVisible. We're not picturing users running screaming down the halls because they can't make their returns visible and their spaces invisible. Then again, we haven't met your users. The help file in the release candidate we're looking at while writing this article documents other changes about as equally alarming to us. Then again, we haven't seen your application. Do your homework. Read the documentation (as you should with all changes in all releases) and make sure that the changes don't affect your application adversely.

Conclusion
The new Rich Edit Control provides some much-needed improvement to the rich formatted text handling capabilities. Features like new import and export types will provide your users with benefits almost immediately after upgrading. Other features, like the API that facilitates spell checks, create opportunities for your application further down the road.

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.

YOUR FEEDBACK
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.
PBDJ LATEST STORIES . . .
Join Scott Guthrie as he discusses Microsoft’s commitment to web standards development, Rich Internet Applications and how Microsoft is contributing to help move the web forward. Join Adobe’s Kevin Lynch as he demonstrates how Flash and HTML come together to make the most engaging,...
Particularly in a means of moving PowerBuilder applications to the web. What I’m looking for doesn’t require a server license or the installation of unmanaged code to the web server, and works well across different browsers (not just Internet Explorer). The WPF DataWindow will help...
"The rise of Enterprise Architecture is proof that organizations need to manage the impact of changes in competition, technology and regulations across their enterprise," said Dan Lahl, director of Intelligent Enterprise for Sybase. "PowerDesigner 15's unique Link and Synch technology ...
With PowerBuilder 11 Sybase gave developers what we have long hoped for – the possibility of taking an application created in a client/server architecture and turning it into a Web application, almost without having to move the code; and it's better if you don't use a server applicat...
Like any standard .NET application, the PowerBuilder .NET application follows the common language runtime rules regarding the permissions needed to do the operation the application aims to do. The code access security (CAS) provided by the .NET Framework is a security mechanism that a ...
PowerBuilder 11.0 supports deploying existing PowerBuilder client/server business applications as an ASP.NET WebForm application. This greatly improves developer productivity without having to learn a new development language and preserves PowerBuilder development skills. Although the ...
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 365, a subsidiary of Sybase, Inc. (NYSE:SY), the global leader in mobile mes...