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


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


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

Enterprise Open Source Magazine Latest Stories . . .
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-Service (Sa...
All the buzz surrounding OpenStack over the past few months may beg the question of whether Openstack can repeat for Cloud what Linux has done for server operating systems over the past several years. With an enthusiastic following and a compelling, if not industry-leading set of funct...
Virtual Desktop Infrastructure (VDI) has been a hot topic in the IT community for years but delivery models have limited its use. Today there are real options for using the technology to truly replace the existing desktop infrastructure to realize tangible benefits. Today’s cloud-sourc...
VMware hypervisors of the ESX family (3.x, 4.x and 5.0) are fully, out-of-the box supported by the latest versions of OpenNebula(3.0+). If you have a server farm based on any of the ESX versions, then you can make use of OpenNebula to better manage your physical (and virtual) resources...
Data centers today are stretched to the limits with fast-paced business demands. On top of that, integrating and managing IT infrastructures can pose major challenges. Organizations need a new solution that consolidates servers and workloads without breaking the bank—and Linux, togethe...
Atlantis Computing, a provider of Virtual Desktop Infrastructure (VDI) storage and performance optimization solutions,has announced the release of Atlantis ILIO Diskless VDI 3.2, a solution that enables VMware View customers to deploy virtual desktops with no storage. Atlantis ILIO Dis...
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