Tech Articles


Spell checking in the new PowerBuilder 2017 Rich Text Edit Control


The original Rich Text Editing control shipped with PowerBuilder was based on an OEM of a popular third party control at the time called HighEdit. By the time 10.5 came out though, that control was quite dated and no longer supported by the vendor. As a result, in 2006 Sybase replaced that control with an OEM of another popular third party control called TX Text Control. There are licensing issues with that control though.  So with the release of PowerBuilder 2017 Appeon updated the control again, replacing the OEM of the TX Text Control with an OEM of the TE Edit Control. Note that if you encounter regressions with the new control you can switch back to the TX Text Control through a new RichTextEdit option in the Additional Properties dialog for the application object.  If you do however, you will have to obtain your own license of TX Text Control.

 

One feature that became possible when Sybase adopted the OEM of the TX Text Control was in place spell checking of the text through third party utilities like JRSpellSentry Spelling Checker Engine for Windows or VSSpell. With the previous control, about the only thing you could do was copy out the unformatted text, spell check that using Word through OLE Automation, and then paste back in corrected, but unformatted, text.  Many people found losing the formatting of the text an unpleasant side effect of spell checking that way.  The new controlled allowed spell checking to be done without losing formatting.

In order for those third party utilities to perform in place spell checking, they needed to be provided with the handle to the control containing the rich text.  In an article I did for the PowerBuilder Developers Journal when the control was first introduced, I provide sample code for obtaining the control handle to pass to those utilities.  The sample code was essentially this, where a_rte is a reference to the PowerBuilder rich text edit control:

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

Starting with the PowerBuilder RTE control we had to drill down three levels until we reached the part of the OEM TX Text Control that contained the text.  FindWindowEx is a windows API call to get a control handle based on a class name.  The text values included here are the class names that PowerBuilder used for the various controls.  Note that each time a new version of PowerBuilder was released and referenced a newer version of the TX Text Control the last class name used here had to be updated for the class name for that version.

With the new rich text edit control in PowerBuilder 2017 we use the same technique, though we don't have to drill down quite so deeply.  The code I'm using now in my migrated PowerBuilder 2017 application looks like this.

 ulong        hWin  
 hWin = Handle ( a_rte )  
 hWin = FindWindowEx ( hWin, 0, "Ter24Class", 0 )  

 

Comments (7)
Thursday, Jul 20 2017

There seems to be a solution without doing this, in the Help topic "Using an ActiveX spell checking control", which I found by searching for "spell" in the Index of the Help.

#16
0
Monday, Oct 14 2019

I believe the difference is that the solution in the help copies the text into the ActiveX control and does the checking there. The approach I'm using allows the spell check utility to do the checking within the rich edit control.

0

Friday, Aug 18 2017

"Licensing issues" is a weird wording. There are absolutely no licensing issues with TX Text Control and PowerBuilder. Appeon simply didn't renew the license contract which was in place with Sybase and SAP and replaced the control with another, cheaper vendor. If you are facing any issues with that new RTE control, contact us at Text Control and we will help you.

#17
0
Monday, Oct 14 2019

how to use rich text edit control to spell check , please define step by step

0

Tuesday, Mar 13 2018

Bruce, thank you for informative history of the PowerBuilder Rich Text Editing control.  You stated you are using the same technique.  I too have tried this technique but am finding that though the spell check software does work with the new TE Edit Control it does not preserve the formatting.  Have you experienced this also?  If you have found a spell check solution that works with the new control and preserves the rich text formatting, can you give me some insight so I can do the same?

Thank you

#18
0

Thursday, Mar 15 2018

FYI - I submitted Bug 894 to report the formatting of the new PowerBuilder 2017 Rich Text control not preserving the formatting when issuing a standard ReplaceText function to the control.  This was working in 12.6 and is now broken with 2017.  This issue is likely also causing the spell check when referencing the rich text control to produce the same results.

#19
0

Find Articles by Tag

Application SnapDevelop TreeView Visual Studio JSON REST Deployment PowerBuilder Elevate Conference Array Trial Validation External Functions Outlook Service Database Table Schema Authorization 64-bit COM HTTPClient XML Web Service Proxy OAuth 2.0 Icon PowerServer Mobile Automated Testing Windows 10 Icons Database Object Data Database Painter PDFlib BLOB Linux OS Database Table Data NativePDF Import JSON Interface Menu Installation Oracle MessageBox PBNI PostgreSQL ODBC Stored Procedure Database Graph Window UI Themes UI RESTClient CrypterObject IDE Database Profile DLL RichTextEdit Control Source Control .NET DataStore Azure Excel PowerBuilder Compiler TortoiseGit API Open Source Variable Design Error SQL Debugger PowerServer Web Encryption File Event Handling Filter JSONParser GhostScript Performance Messagging Class 32-bit Charts RibbonBar CI/CD Jenkins Mobile DevOps Debugging PowerScript (PS) DataWindow JSON Database Connection PBVM DragDrop Testing Event SOAP DataWindow Web API Text SDK JSONGenerator PDF License Event Handler Debug Expression Transaction Sort OLE TFS CoderObject .NET Assembly Resize Database Table OrcaScript UI Modernization OAuth Git Source Code SqlModelMapper Platform PBDOM Bug .NET Std Framework Windows OS SQL Server Android Migration Export JSON iOS WinAPI PowerBuilder (Appeon) Authentication WebBrowser Syntax TLS/SSL Script SnapObjects C# Import Encoding SVN ActiveX Export DataType Model PFC Repository RibbonBar Builder Branch & Merge Configuration InfoMaker PostgreSQL ODBC driver SqlExecutor