2
votes

Our PowerBuilder application is fairly large and has many objects in several PBLs for organizing our code. We often have 10 or more datawindows on one window, and these datawindows may be spread across two or three PBLs. For version control, we use exclusive check-out to avoid merge conflicts.

The situation is that when you right-click on a datawindow object from the Window painter you get a context-menu with options like "Script" and "Properties" and "Modify Datawindow...". We'd like to add one for "Check-out..." to avoid having to hunt for the datawindow in several PBLs.

Any ideas on how to do this, or something similar, would be greatly appreciated.

4
Sounds like a really nice idea but I can't imagine how you would go about it. The IDE doesn't really support plugins AFAIKColin Pickard

4 Answers

2
votes

I think the best you can do is to create a temporary library at the top of your library list, locate your datawindows by jumping to them via "Modify Datawindow...", then saving them into your temporary library, and finally using the tools in your source control system to locate them by name and lock them.

One other trick that I use is to uncheck the tick box in the source control options that clears down the .srd etc files, then using your operating system's find tools to search on file name for these (since Powerbuilder still doesn't support searching for objects by name...). Of course if you don't have many objects, and if your objects don't have many references, you could always use Powerbuilder's search... but who do you know in the that fortunate position?!!

1
votes

I think you've hit on a problem that a lot of people run into, which runs right through a loophole in PB that lets you start editing a DataWindow without warning you to check it out. Unfortunately, to the best of my knowledge there is no way to hook into the context menu.

However, you can hook into toolbar items. If that was the way I wanted to go, and I had plenty of time to spare, I'd write an app that I would launch from the toolbar, and here's what it would do:

  • Find the PowerBuilder window with APIs
  • Find the current sheet in PB
  • Get the object name out of the title
  • Get the current application (registry or PB.INI, depending on the version of PB, and may involve getting the workspace first, then the current target)
  • Get the library list (PB.INI or target file)
  • Do a LibraryExport() on the object that's open
  • Find all DataWindow controls (this may involve looking at ancestors to determine control types)
  • Identify dataobjects for these controls (again, you may need to look at ancestors)
  • Use LibraryDirectory() to get a list of all objects in all PBLs
  • Find the dataobjects' PBLs
  • Throw up a window listing the dataobjects and their PBLs

OTOH, if I had PBL Peeper (and, yes, this is biased advice), I'd

  • Launch the "PBL Peeper (Browse current application)" icon on my desktop (OK, that's a lie; I'd already have PBL Peeper open and would just switch to the Browse page)
  • Ctrl-Q (for QuickFind) and start typing the name of the object (if you pause, it will find a partial match on what you've typed)
  • Hit [Enter] once to accept QuickFind's selection
  • Hit [Enter] again to expand the object
  • Find the DataWindow control in question and RMB on it
  • Select "Go to Default DataWindow"
  • If it doesn't show the library and name in the microhelp (it's been a long time since I've released a version, and I can't keep track of what's in the released version), find the Up toolbar item to go up to the PBL

I know this doesn't achieve a checkout, but it does "avoid having to hunt for the datawindow in several PBLs". And, you can probably achieve this faster than my first suggestion.

Good luck,

Terry

1
votes

The way I do it is to right-click and choose Modify DataWindow. When the painter opens you can just read the PBL from the title of the painter. Then close the DataWindow painter so PB will let you check out the DataWindow. For the more general case of locating an arbitrary user object, use Terry's PBL Peeper method.

0
votes

You could separate the organization of PBLs used for development from those used for deployment.

As long as the PBL names don't conflict between the two views into the source code. The PBG files registered in source control won't clobber each other.

The downside is that when new objects are added or deleted, you will need to update both locations.

I would create a datawindow only PBL with all the related objects and put them in the same target. When I worked with that sub-system or report i could then check out all the objects in the same library.