PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Event Naming Standards
When defining custom events in PowerBuilder a lot of people plum for the old slap a ue_ in front of the name and be done with it. The problem with this standard is that as the number of events increases it becomes more difficult to find the one you are after. Also you cannot make use of the type and scrolling feature in the drop down list box of event names in the script painter.

I have found a combination of prefixes and non prefixed events works well.

Standard Events
For events that are not custom, these are events that PowerBuilder defines as standard for a control but are not mapped, for example. On a command button the pbm_bndoubleclicked event has not been mapped in PowerBuilder, although you probably would not want to map this event if you did you should name the event doubleclicked, taking the name the event in the PowerBuilder event mapping dialog.

Class Library Events
If you where creating an event in the Class Library then you should name the event beginning with ec_ so that people can distinguish that it is an event created and controlled by the base level of the class library. Taking our previous example if we added a post double click event we would name it ec_postdoubleclicked.

Insulation Layer Events
Events defined in the insulation layer of your Class Library for project level enhancements should be labeled with a prefix of ic_ following the standard of the base Class Library.

Menu Events
In our Class Library we also have a series of events that are performed in the application sheets. These event names are taken from the menu names and are all processed automatically by our window services. However we also allow the developer exit points for the menu operations. We label these events me_ for menu event. For example me_presave, me_save, me_postsave. These events are mapped by the developer as required.

Other Events
The last category of events are those created by the developer for their own need in an application window. These events should be prefixed ue_. That way we can tell at a glance events added by the developer for this object or window.

Summary
By using a set of naming standard for event we can derive a lot of information about where they where defined and even what they where defined for. This set of standards may not suit your needs exactly so feel free to tailor them to your needs.

 

Top of Page

Legal Notice

Ken Howe 2011