Resource of Information about SAP Business One

SAP B1


SAP-B1 Authors: Liz McMillan, Maureen O'Gara, Dana Gardner, Bruce Armstrong, Pat Romanski

PowerBuilder: Article

Nuances of the PowerBuilder 7.0 IDE - It Wants You to Be as Productive as You Can Be

Nuances of the PowerBuilder 7.0 IDE - It Wants You to Be as Productive as You Can Be

Imagine hiring a crew to put an addition on your home. As capable as they seem, you can't help being concerned over the fact that they've shown up for work without any power tools. Every instrument they use looks like it came from Olsen's Mercantile in Little House on the Prairie. When you ask the crew why they don't own any power tools, the foreman responds, "Oh, we own them. We're just more comfortable with these hand tools." After explaining how they could cut their work time in half by using them, the crew concede, break out the power tools and bring in the backhoe. You look in horror as you see them using these expensive devices in the same fashion as their hand tools. They drive nails by smashing them with the nail gun. They cut wood by manually pushing the electric saw back and forth. We won't even mention how they're using the backhoe.

Many PowerBuilder developers are doing the same thing with their new PB7 IDE. If they're not flat out avoiding its use, they're not familiar enough with its new features to be as productive as Sybase wants them to be. I stand as guilty as the next developer. Once I read through and tried everything in the User's Guide, I realized how productive we all could be. There's a score of nuances in the PB7 IDE that can cut hours of work from each project. I'll be discussing those features that will have an immediate impact on your productivity.

Where's That Window Again?
If you're like me, you've got all of your objects organized exactly as Sybase recommends. Classified by subsystems and functionality, you've got loads of PBLs all under 1MB in size. Of course, if you're really like me, you still can't remember which PBL holds the window you're need to work on. In previous versions of PowerBuilder the Select Window dialog showed the entries of only one PBL at a time. If you didn't feel like clicking through each PBL, then scrolling through the entries, you could open the window from the browser - but that's a pain.

PB7 makes this task easier by allowing multiple libraries to be selected in the Open dialog (see Figure 1). Now you can see all of the windows in the selected PBLs sorted alphabetically, making it a cinch to find your window.

Let's say you also want to know where your window is referenced throughout your application. You used to be restricted to searching one PBL at a time via the library painter or using the ADK's PowerBuilder Object Searcher. Now, within the library painter, we have a Global Search option under the Design menu that allows a complete application search. The only thing that could make this better is a Global Replace option.

Attention Keyboard Enthusiasts
Are you one of those developers whose hands come off the keyboard only when absolutely necessary? PB7 should make you a little happier. As you're no doubt already aware, the File menu now offers recently used lists for Objects, Applications and Connections. You can opt to list up to 36 Recent Objects, 36 Recent Applications and 10 Recent Connections. This is a big timesaver. Sybase, however, took it one step further and enabled us to assign Keyboard Shortcut keys to menu items. If you want to flip between the last several objects you've worked on, simply set up the Keyboard Shortcuts under the Window menu (see Figure 2). The "recently used" menus are just one example. You can set up shortcuts to almost every menu item in the IDE, regardless of their level in the menu structure. You can even change the native shortcut keys. It'll take a little time to set up and some repetition before it becomes second nature, but it'll be worth the investment when you're flying around the IDE like greased lightning.

Lazy Coders, Your Ship's Coming In
If you're not as much the keyboard enthusiast as you are lazy about coding, AutoScript is for you. AutoScript lists the possible completions to your code as you type. This is also useful for those of us who sometimes have trouble recalling object function names. It takes a little getting used to. The way it works is you type something like:

// AutoScript Example, Clicked Event of a Window
THIS.
You pause for about one second and a list appears (see Figure 3) showing all of the possible completions you've configured for AutoScript (AutoScript is configured under the menu items Design, Options). You can include or exclude Local Variables, Class Variables and Class Functions. If you've included them all, the example above would list things like ArrangeSheets( ), BackColor, Border, ClassName( ), Control[], etc. Also listed would be any objects on the window itself and local variables in the script. The list can be substantial, but it'll scroll if you type the first few letters. If you're the kind of person who likes to type as little as possible, AutoScript will serve as a nice appetizer. You probably won't be happy until every bit of code can be clicked and dragged into the Script View. Speaking of click-and-drag...

Click-and-Drag Dynamite One feature you should make a habit of using is the clicking and dragging of objects into the Script pane. Say you want to code a DataWindow on the window you have open in the Layout pane. Simply drag the DataWindow into the Script pane and you're in its script. You can do this with any object in the Layout pane, except for the window itself. Don't worry, though. If you still want to click-and-drag the window into your Script pane, just use the Control List.

Everything in the Control List pane can be dragged into the Script pane, including items from the Nonvisual Object list tab. Keep in mind that NVOs, declared as Instance and Shared Variables, don't show in the NVO List. Only the objects you insert into the window appear there. Once in the list, you can click-and-drag them into the Script pane and code them.

Another great drag-and-drop feature added to this version is in the Library painter. You can now select multiple objects and drag them to any PBL.

Coding NVOs in the Objects That Use Them
Starting with version 7, you can insert NVOs into your objects and code them at the concrete level. Previously, if you had an NVO containing application-wide business rules and wanted it to have one event that held code for a specific window, you had two choices. You could either add the event to the NVO and call it from your specific window, or create a descendant of the NVO and put the event there. Either way, you've got some overhead. The first option contributes to having a fat ancestor object and the second requires maintenance of an extra object. Now you can insert the NVO into your window and add the event there. It's sort of a virtual descendant bound to the window. This has no effect on the original NVO, and you've got your window-specific NVO event.

To do this from the window design panes, choose the menu items Insert... Object... User Object, then pick your NVO from the dialog; it becomes an object in your Control List (see Figure 4). Now you can code the NVO for this window.

tart Wherever You Want
Wouldn't it be nice if PowerBuilder knew exactly which painter and object you wanted to work on and brought you there upon application start-up? Believe it or not, you've been able to do this for a while. Take the most common painters (and objects, if applicable) you use and set up different shortcuts on your desktop with the appropriate command-line switches and arguments. For example, say you want to start PB and go right to the DataWindow painter. You'd add the painter switch specifying "dataw" as the argument. Your shortcut would read something like:

"C:\Program Files\Sybase\PB7\PowerBuilder 7.0\pb70.exe" /P dataw

In PB6.5, this would take you directly to the select DataWindow screen. In PB7, it takes you to the new DataWindow screen. If you'd like to go to a specific DataWindow object, you add the library and object switches and their respective arguments. Your shortcut would read:

"C:\Program Files\Sybase\PB7\PowerBuilder 7.0\pb70.exe" /P dataw /L master.pbl /O d_emp_report
Specifying the exact object in a shortcut really wouldn't be useful, unless you plan on working on the same object for a week or more. This would be more practical in the Run dialog. Some practical (7.0) desktop shortcuts would be:
New window
"C:\Program Files\Sybase\PB7\PowerBuilder 7.0\pb70.exe" /P window
Inherit from a specific ancestor UserObject
"C:\Program Files\Sybase\PB7\PowerBuilder 7.0\pb70.exe" /P userobject /I n_ancestor
If you're the type that plans the order of object creation methodically, this feature will prove most useful. For all the possible arguments and combinations, see the User's Guide.

And the Moral of the Story Is...
Read the User's Guide. I'm telling you truthfully, this is the first version of PB where I've read the User's Guide from start to finish, and I've been using PB since version 4. I've found there are many features in PowerBuilder that can make our jobs easier and I only learned about them by reading the User's Guide. If you're dead set against reading the User's Guide, hopefully this article has shown you all you need to become even more productive than you no doubt already are.

More Stories By Tom Peters

Tom Peters is director of online applications for Sherwood International in Armonk, NY, an ISV that specializes in insurance software. Tom is a CPD professional with over 15 years' experience.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.