Comments
Matt McLarty wrote: For more info... Follow me on Twitter See our website
Cloud Expo on Google News

SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
Implementing an Intellisense-like System Using PowerBuilder and the .NET Framework
Making PowerBuilder more productive

Pbintelli is an application that helps PowerBuilder developers write code faster and more accurately.

The principal features implemented are:

  • Shows variables, functions, and events of PowerBuilder's objects
  • Pastes selected variables, functions, or events directly into the PowerBuilder editor
  • Shows DataWindow fields
  • Shows enumerated values
  • Acts as a code repository
  • Copies application files
  • Creates PBR files
  • Acts as an object finder
  • Can be used as an system/API function finder
All these features can be called directly from the PowerBuilder IDE. In some cases PBintelli acts like an IntelliSense system and presents a list of insertable objects/functions. In others the developer can invoke the functionality by selecting an item from the context menu that appears once the F6 key is pressed. In this article the focus is on the implementation of the IntelliSense feature. I will describe the techniques used to achieve this behaviour.

Overview
The first problem, if you want to write an add-in for PowerBuilder, is the interaction between your application and the PowerBuilder environment. Currently there's no API defined for interacting with the PowerBuilder IDE, so the only thing to do is to use some kind of workaround.

There are a number of applications that run in background and detect user activity. PBintelli uses a keyboard hook to trap when the user presses a key. Naturally only the actions fired from the PowerBuilder code editor are significant; all others are ignored. The hook is automatically installed when the object is created, but you can stop and start the hook from listening using the appropriate buttons. A hook lets you insert a callback function that intercepts certain Windows messages and lets you respond with some action. The hook is written using C# language (you need a language that supports pointers to functions) and uses the Windows system function SetWindowsHookEx.

When a key is pressed in PowerBuilder code editor the background application receives a notification with the key-code pressed and the Window handle that raised the event. The handle is important because it makes it possible to send messages to the code editor Window and obtain information such as the text displayed and the caret position. (See the article entitled "Custom Common Dialogs Using SetWindowsHookEx" from the April issue of PBDJ for more information on creating hooks).

The program then parses the text in the script editor and calls a COM object that was written in PowerBuilder. The COM object uses the PowerBuilder Class Definition Object Library functions to analyse the text. To use these functions it's necessary to reference a library list. The COM object determines the library list to use by looking for the last workspace saved in the PB.INI file. The COM object is initialized with the library list every time the current target changes. For example, here's the C# code that PBintelli uses to find the signature of a user function:

PBintelli_90.COClass_PBintelli_90Class obj9;
obj9 = new PBintelli_90.COClass_PBintelli_90Class();

obj9.of_settolibrerie(arg_lib);
ret = obj9.of_getfunctionsignature (function_name, ref ls_signature);

The Function_name is a string containing the name of the function and ls_signature is an output parameter of the string type that receives the signature.

There's a wrapper class that manages the different versions of PowerBuilder (there's a different COM object for every supported version of PowerBuilder), if the version changes the class internally uses the correct COM object for that version. The information returned by the COM object is then exposed using an interface written in C#.

About Tracogna Roberto
Tracogna Roberto is a project manager at Multimedia s.r.l, an Italian IT company that provides medical software products. He has more than 10 years of experience in software design, development, and implementation. Tracogna holds a degree in computer science from the Department of Mathematics and Computer Science at the University of Udine in Italy.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Latest Cloud Developer Stories
Enterprise IT organizations want to deploy a virtualized data center fabric that will provide the foundation for agile private cloud computing. Getting there does not have to be difficult, but it does require a new approach to data center infrastructure design – an approach that ...
New tools and services for swift software-as-a-service integration in the cloud lowers the barrier to SaaS adoption for SaaS providers and developers. MuleSoft this week launched Mule iON SaaS Edition, providing a broad set of new tools and services for swift software-as-a-Servi...
With Cloud Expo 2012 New York (10th Cloud Expo) now under four weeks away, what better time to introduce you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference...
How can businesses harness the power of APIs to reach new customers and markets? In his session at the 10th International Cloud Expo, Alistair Farquharson, CTO at SOA Software, will walk the audience through the growth and evolution of the API, why effective API management is i...
With Cloud Expo 2012 New York (10th Cloud Expo) now under four weeks away, what better time to introduce you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference...
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 Cloud Computing News
GeoMet, Inc. (NASDAQ: GMET) ("GeoMet" or the "Company") today announced its financial and operating ...