Comments
Matt McLarty wrote: For more info... Follow me on Twitter See our website
Cloud Expo on Google News

SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
Implement a Calendar Component in PowerBuilder Applications
Enhance the look of the calendars within your scheduling modules

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).

About 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.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Latest Cloud Developer Stories
Enterprise IT organizations want to deploy a virtualized data center fabric that will provide the foundation for agile private cloud computing. Getting there does not have to be difficult, but it does require a new approach to data center infrastructure design – an approach that ...
New tools and services for swift software-as-a-service integration in the cloud lowers the barrier to SaaS adoption for SaaS providers and developers. MuleSoft this week launched Mule iON SaaS Edition, providing a broad set of new tools and services for swift software-as-a-Servi...
With Cloud Expo 2012 New York (10th Cloud Expo) now under four weeks away, what better time to introduce you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference...
How can businesses harness the power of APIs to reach new customers and markets? In his session at the 10th International Cloud Expo, Alistair Farquharson, CTO at SOA Software, will walk the audience through the growth and evolution of the API, why effective API management is i...
With Cloud Expo 2012 New York (10th Cloud Expo) now under four weeks away, what better time to introduce you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE

Breaking Cloud Computing News
GeoMet, Inc. (NASDAQ: GMET) ("GeoMet" or the "Company") today announced its financial and operating ...