| By Alon Baadani | Article Rating: |
|
| September 21, 2009 06:15 AM EDT | Reads: |
7,295 |
Those who answer to users probably agree that the style of the PowerBuilder applications have remained unchanged for far too long. While major improvements are anticipated with the release of the PowerBuilder 12 beta, developers who would like a quick face-lift for their applications are invited to continue reading here.
RES-Q Healthcare Systems (www.res-q.com) is a provider of resource management software for hospitals. The RES-Q software includes applications for enterprise-wide employee scheduling and staffing, surgery department management and procedure scheduling, patient acuity classification, and productivity management and reporting. These applications are built with PowerBuilder. The constant marketplace demand for applications that have a fresh modern appearance prompted us to search for various ways to enhance the look of the calendars within our scheduling modules.
After extensive research we chose a component from a third-party provider -Codejock Software (http://www.codejock.com). This component,
compellingly priced and with an Outlook 2007 style, provided the look and feel we sought (see Figure 1).
Codejock exposes access to its calendar's elaborate object model through OCX technology, with several data store solutions, as XML, MAPI, and databases. The calendar's built-in functionality provides an almost complete solution for anyone willing to store data in an XML file format. However, to meet RES-Q requirements we had to implement a data layer code to store scheduled events in a SQL Anywhere database. Fortunately, Codejock provides Visual Basic code samples for a similar implementation using MS SQL Server. From that starting point Codejock's Mark Doubson contributed to create a PowerBuilder implementation; this demo application is available on CodeXchange (www.sybase.com) as well as from here.
This is by no means a complete application and it uses a limited set of the functions that are available by the OCX. Yet, it will demonstrate what you can do and how to work with this control.
Here are some basic instructions to help you get started:
- Download the calendar and samples from www.codejock.com.
- Register the OCX using regsr32. Here is an expedited way to do this:
- Select the OCX through Windows Explorer.
- Use Ctrl-Shift-Right Mouse to "open with" the OCX.
- Choose [default] program.
- Browse to Windows\System32 and select regsvr32.exe.
- Check to always use the selected program.
- With that done, all you need to do is double-click on the OCX. A successful registration message should display.
A word of caution: OCX runs on each client workstation in a networked environment and requires local registration of the OCX file. This local registration can be done automatically at runtime, at least on Windows XP.
- From the Insert | Control | OLE... menu Insert the OLE Calendar control on to a window (see Figure 2).
- Repeat the last step for the DatePicker control. See Figure 4 for both the DatePicker control - top - and Calendar control - bottom.
- Create a table in your database. You can use the demo database that ships with PowerBuilder; the create table and insert sample data scripts are provided with the source code.
- Create two DataWindows, d_events and d_eventlist. Both use the CalendarEvents table as their data source. The DataWindow d_events retrieves by eventid.
- Write code for the window and calendar events and functions. The entire source code is available for download from Sybase's CodeXchange and Codejock's forum.
PowerBuilder's compiler accepts the OLE Object's Functions and properties without any type checking (as it doesn't know what syntax is expected).
This exposes your application to runtime errors during execution, which can occur when an invalid property or function name was called. Using exception handling, application termination errors can be avoided.
TRY
OLEcontrol.object.property = value
CATCH (RuntimeError er)
Messagebox ("Error", er.getmessage ())
END TRY
You will be working with visual (insertable) controls and non-visual programmable objects. For the visual controls, PowerBuilder automatically includes create and destroy code. Refer in scripts to the control with the Name property as you have specified in the control's general tab. This applies to the calendar and DatePicker controls. However, many other objects are available and are required for implementing various calendar functions, i.e., adding events. The help file provided with the control is a good resource to discover the objects, properties, and methods you can use (see Figure 3).
Working with programmable objects requires you to manage their reference variables. You will need to declare an OLE Object variable, allocate memory for it, and destroy it:
OLEObject myoleobject
myoleobject = CREATE OLEObject
myoleobject.ConnectToObject(classname)
....
Destroy myoleobject
Here is a short guided tour to using the controls. Prepare to be wowed!
- Use the navigation arrows to move around the calendar.
- Switch views - day, week, or month - and notice that clicking any day of a month places you on that day, when in day view.
- Select different days using the DatePicker while in day view. When holding the control key down, notice a multi-day custom view is created with these non-consecutive days (see Figure 4).
- Double-click on the calendar to add or modify events with a dialog, or just edit data in place. Right-click while the cursor is on an event to display a popup menu for Add/Modify/Delete/Print.
- Click on the symbol found on the right-hand side of the caption bar. A print preview screen for the current view appears.
You are given a wealth of properties to manage the appearance and configuration of the calendar control. You may choose to expose these property controls to the user with your application's implementation (similar to what we have with the Theme selection accessed in the tool bar Options menu as shown in Figure 4).
Published September 21, 2009 Reads 7,295
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Alon Baadani
Alon Baadani, as the principal of ABM Consulting, has been developing PowerBuilder applications for both large corporations and small businesses over the last 12 years. Currently, he is developing applications for RES-Q HealthCare Systems, an industry leader with presence in the U.S., Canada, and the EU. you can contact Alon at alon(at)abmsoftware.net.
- Cloud People: A Who's Who of Cloud Computing
- Kevin Benedict’s What’s New in HTML5 – Week of May 19, 2013
- Cloud Expo New York: From Your Datacenter to the Cloud and Back
- Embarcadero Technologies Unveils Multi-Device, True Native App Development Suite
- Mobile Commerce News Weekly – Week of May 5, 2013
- Appeon 2013 - Product Release
- Mobile Commerce News Weekly – Week of April 28, 2013
- Mobile Health News Weekly – Week of May 5, 2013
- Mobile Health News Weekly – Week of May 26, 2013
- Mobile Health News Weekly – Week of April 28, 2013
- Mobile Health News Weekly – Week of May 12, 2013
- Transaction Processing Performance Council Announces Fifth Annual International Technology Conference on Performance Evaluation and Benchmarking (TPCTC 2013)
- Cloud People: A Who's Who of Cloud Computing
- Gradients, Not Glitz: Methods to Modernize PowerBuilder User Experiences
- Come on in, the Forums Are Fine…
- Global Mobile Security (mSecurity) Market 2013-2018
- Kevin Benedict’s What’s New in HTML5 – Week of May 19, 2013
- Whither Windows?
- Cloud Expo New York: From Your Datacenter to the Cloud and Back
- A Look at Appeon Mobile
- Enterprise Mobility Asia News Weekly – Week of April 7, 2013
- Embarcadero Technologies Unveils Multi-Device, True Native App Development Suite
- Mobile Commerce News Weekly – Week of May 5, 2013
- Appeon 2013 - Product Release
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- DDDW Tips and Tricks
- Cloud People: A Who's Who of Cloud Computing
- Dynamically Creating DataWindow Objects
- Working with SOA & Web Services in PowerBuilder
- OLE - Extending the Capabilities of PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Custom Common Dialogs Using SetWindowsHookEx
- Dynamic SQL
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Sybase ASE 12.5 Performance and Tuning

























