| By Hoyt Nelson | Article Rating: |
|
| October 3, 2003 02:00 PM EDT | Reads: |
12,824 |
It's an aesthetic thing. When you click on a grid DataWindow
label and change an attribute, it acquires what are formally termed
UGBs - Ugly Grid Borders. They appear between the labels in the grid
header. The vertical lines are thin or thick. Inconsistency! Thick
borders! Yuck! Figure 1 illustrates the problem.
There are thick borders between the Nickname and Last Name labels and between the Company and Nickname columns; there are thin borders between the Company and Nickname labels and between the Nickname and Last Name columns.
Figure 2 shows the same DataWindow with the UGBs fixed.
All the borders are thin in Figure 2, which looks a lot better.
The UGB problem is characteristic of 3D objects on grids. The detail columns in the figures are 3D lowered. You don't have to worry about UGBs if all your DWO objects are flat.
With PB6 and earlier releases it was easy to fix the UGBs manually: select the left-most column label, hold down the shift key and press the right arrow key to select all the labels, then right-click that left-most label and select Bring to Front from the popup menu.
With PB7 (and later) that trick stopped working: you can't fix all the labels in one operation. With recent versions of PowerBuilder, you have to fix one label at a time, going left-to-right: right-click the label, Bring to Front, right-click the next label, Bring to Front, etc., for every label on the grid; ditto for columns. It's a pain.
This article presents a programmatic solution to UGBs. It turns out that the problem is how lines are ordered in the DWO syntax. The code presented in this article fixes the DWO syntax, banishing those embarrassing UGBs. Once you're set up, you can fix all the UGBs in your application in a few minutes. It becomes part of the build process, so your programmers can ignore the problem and your users are forever spared UGBs. A utility for fixing UGBs is provided.
Looking at the Syntax
In DWO syntax, labels correspond to text objects. If you look
at the exported DataWindow syntax, before and after fixing the UGBs,
you'll find that the order of the text object declarations has been
changed. The first part of the text object syntax line looks like:
text(band=header S x="9" y="8"S
It turns out that the critical part of the syntax is the x attribute, x="9" in the line above. When a grid has UGBs, the text lines are not in x-attribute order. The following shows how the text object declarations are ordered when the UGBs have been eliminated:
text(band=header S x="9" y="8"S
text(band=header S x="338" y="8" S
text(band=header S x="3470" y="8" S
The x attributes are 9, 338, and 3470 - monotonic ascending order.
Here's what I infer: PB instantiates DWO objects, processing the DWO syntax in top-to-bottom order, and the UGBs appear when the objects' order of instantiation is not uniformly left-to-right.
The solution is to reorder the 3D-object syntax lines according to their x attribute.
The Code
The main function is f_fix_ugly_grid_borders(). It takes a DataWindow control (DWC) upon which the target DataWindow object (DWO) appears. Here is a high-level
description of f_fix_ugly_grid_border():
Another function is called during the process above: f_get_dw_syntax_as_array() takes the DWC and returns the DWO's syntax as an array. This function is needed because DWO syntax sometimes wraps lines:
text(name=department_t band=header ...
Rule in English" )
After the syntax has been placed in an array, the array has to be processed to move the wrapped bits to the end of the preceding array element, e.g., putting "Rule in English" at the right end of the "department_t" line. Otherwise, those bits would be lost when the lines are reordered. Another function processes the PBLs that make up the application. It passes through the PBLs, doing a LibraryDirectory() on each to get the DataWindow objects contained therein. It then sequentially passes those DWOs to f_fix_ugly_grid_borders(). It takes about five minutes to fix a couple hundred grids.
You can download a small utility from www.sys-con.com/pbdj/sourcec.cfm that will apply these functions to fix up your application's grids. The source code is included as well.
Summary
Since we took up PB7 and later versions, most of us have had
to live with Ugly Grid Borders, since they were so cumbersome to fix
manually. The technique presented here will make it easy for you to
eradicate them. Download the utility and say goodbye to the
heartbreak of UGBs!
A final suggestion: f_fix_ugly_grid_borders() can be adapted so it can be applied at runtime. This is useful if your application encourages users to drag grid columns around, e.g., to make columns on wide DataWindow objects visible without scrolling to the right. UGBs always appear when 3D grid columns are reordered at runtime. If you provide users with a means to save their preferred column order for later restoration, you can apply f_fix_ugly_grid_borders() right after the modify() that restores the user's preferred column order..
Published October 3, 2003 Reads 12,824
Copyright © 2003 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Hoyt Nelson
Hoyt Nelson is an independent contractor, a 10-year PowerBuilder veteran, and father to the amazing Nelson, Kent, Emma, and Molly (Hi, kids!).
![]() |
Michael Cornelissen 10/15/03 02:39:28 AM EDT | |||
Yesterday I received the new PBDJ. I was delighted to see this ugly Grid issue fixed: it already bothered me for years. I'm a little bit disappointed that the source file is not available right now. Is that a mistake and will it be available shortly? Regards, Michael Cornelissen |
||||
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- How PowerBuilder Got Its Groove Back
- The Cloud Has Cross-Border Ambitions
- Ulitzer Names The World's 30 Most Influential Virtualization Bloggers
- Ulitzer Named "New Media" Partner of Greatly Anticipated iStrategy Event in Berlin
- Risks and Enterprise Mobility?
- Steps for Success in Enterprise Mobility?
- Are Mobile Luddites Resisting Mobility?
- The Difference Between Web Hosting and Cloud Computing
- Sybase CTO to Speak at 4th International Cloud Computing Expo
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- Five Reasons to Choose a Private Cloud
- Seeding The Cloud: The Future of Data Management
- The Threat Behind the Firewall
- Economy Drives Adoption of Virtual Lab Technology
- Tips for Efficient PaaS Application Design
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- The Top 250 Players in the Cloud Computing Ecosystem
- Custom Common Dialogs Using SetWindowsHookEx
- DDDW Tips and Tricks
- OLE - Extending the Capabilities of PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Book Excerpt: Sybase Adaptive Server Anywhere
- Sybase ASE 12.5 Performance and Tuning
- Working with SOA & Web Services in PowerBuilder
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Dynamically Creating DataWindow Objects

































