| By Alon Baadani | Article Rating: |
|
| September 21, 2009 06:15 AM EDT | Reads: |
1,163 |
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 1,163
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.
- 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 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?
- Hot Event in Santa Clara Becomes Cool with the iPhone
- 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
































