SYS-CON MEDIA Authors: Maria C. Horton, Jason Bloomberg, Elizabeth White, Andy Thurai, Liz McMillan

Related Topics: PowerBuilder, Microsoft Cloud

PowerBuilder: Article

Using a WPF Docking Manager in a PowerBuilder WPF Target

Everything you need to create state-of-the-art GUI applications

In a previous PBDJ article, we looked at using a third-party control, a ribbon control in particular, in a PowerBuilder WPF target. One of the other "most requested" features people have asked for is the capability to provide docking windows in their PowerBuilder applications. In this article, we're going to look at how we can do that in a PowerBuilder WPF application using a third-party docking manager.

The particular docking manager I'm going to use is the AvalonDock, an open source project on CodePlex (http://avalondock.codeplex.com/). At the time of this writing, the current version is 1.3.3571. However, that one has some dependencies on Visual Studio 2010 and .NET Framework 4.0 libraries. PowerBuilder .NET 12 is based on the Visual Studio 2008 isolated shell, so I'm using an older build (1.1.1509) that doesn't have these dependencies.

First, we'll add the AvalonDock assembly and a reference to a new WPF application. Create a new WPF window and add the AvalonDock namespace to the Usings property for the new window. I called that new window w_frame, and coded the open event of the application object to open it. I then dropped a DockingManager control onto the window. Next create a menu (I called mine m_menu) and associate that menu with the new window as well.

I then edited the XAML for the new window to provide a couple of RowDefinitions and to add a StatusBar to the bottom of the window. My modified window XAML looks like this:

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="24"/>
</Grid.RowDefinitions>
<my:DockingManager x:Name="dockingmanager1" Grid.Row="0">
</my:DockingManager>|
<StatusBar Grid.Row="1">
<StatusBarItem Content="Docking Panel Demo"/>
</StatusBar>
</Grid>

The bottom RowDefinition is 24 units high, and the top RowDefinition takes up whatever remaining space there is (the majority of the window). The DockingManager is located in the top RowDefintion (Rows is a zero-based collection), and the StatusBar is assigned to the bottom RowDefinition.

I'm also going to create three instance variables in the window for the ResizingPanel, a DocumentPanel, and a DockablePanel:

ResizingPanel resPanel
DockablePane dockPane
DocumentPane documentPane

In the open event of the window I'll instantiate those items, associate the DockablePane and the DocumentPane to the ResizingPanel, and finally associate the ResizingPanel to the DockManager we added in the designer:

resPanel = create ResizingPanel
resPanel.Orientation = System.Windows.Controls.Orientation.Horizontal!
dockPane = create DockablePane
documentPane = create DocumentPane
resPanel.Children.Add(dockPane)
resPanel.Children.Add(documentPane)
dockingmanager1.Content = resPanel

In the menu, I'll add two menu items: one to open a document "sheet" into the DocumentPane and another to open a "tab" in the DockablePane. They'll just fire events on the window that will actually do the work though. For example:

ParentWindow.event dynamic ue_opensheet()

Here's where it gets interesting. What the docking manager wants to see opening into the DockablePane and the DocumentPane are objects derived from the DockableContent and DocumentContent classes. What we're going to do is create a couple of PowerBuilder custom visual user objects, and then create an inner control on each of those classes. In an existing application, you would need to modify the XAML for your window ancestor classes to accomplish the same thing. The XAML for the resulting objects, u_document and u_panel, look like this Listings 1 and 2. (Listings 1-3 can be downloaded here.)

Now we can go back to w_frame and code the events that open a "sheet" (u_document) and a "tab" (u_panel) (see Listing 3).

Run the app, select the options to open a sheet and a panel two times each, and you should have something that looks similar to Figure 1. Some things to note:

  • Dockable items are capable of autohiding.
  • Dockable items can also be "floated" and moved outside of the frame, even onto a second monitor, giving multi-monitor support.
  • If an item is given a name, the DockingManager can serialize the layout of those items and store it so that it can be reloaded the next time the application runs. The result is that the user's preference for the pane layouts can be remembered between sessions.
  • At any time you can drag an item and use the layout indicators to create new docking groups or move the item onto an existing docking group (see Figure 2).

There you have it - multiple-monitor support, docking panes, autohiding panes and the ability to store and retrieve layouts. Everything you need to create state-of-the-art GUI applications.

Note: Special thanks go out to Peter Conn of the U.S. Census Bureau. His presentation of how he implemented something similar using a commercial third-party docking manager at TechWave 2010 is what prompted me to look into doing it with an open source implementation. He also helped me through some of the stumbling blocks I ran into as I was putting it together.

More Stories By Bruce Armstrong

Bruce Armstrong is a development lead with Integrated Data Services (www.get-integrated.com). A charter member of TeamSybase, he has been using PowerBuilder since version 1.0.B. He was a contributing author to SYS-CON's PowerBuilder 4.0 Secrets of the Masters and the editor of SAMs' PowerBuilder 9: Advanced Client/Server Development.

Comments (2)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Latest Stories
According to the IDC InfoBrief, Sponsored by Nutanix, “Surviving and Thriving in a Multi-cloud World,” multicloud deployments are now the norm for enterprise organizations – less than 30% of customers report using single cloud environments. Most customers leverage different cloud platforms across multiple service providers. The interoperability of data and applications between these varied cloud environments is growing in importance and yet access to hybrid cloud capabilities where a single appl...
"At the keynote this morning we spoke about the value proposition of Nutanix, of having a DevOps culture and a mindset, and the business outcomes of achieving agility and scale, which everybody here is trying to accomplish," noted Mark Lavi, DevOps Solution Architect at Nutanix, in this SYS-CON.tv interview at @DevOpsSummit at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
@CloudEXPO and @ExpoDX, two of the most influential technology events in the world, have hosted hundreds of sponsors and exhibitors since our launch 10 years ago. @CloudEXPO and @ExpoDX New York and Silicon Valley provide a full year of face-to-face marketing opportunities for your company. Each sponsorship and exhibit package comes with pre and post-show marketing programs. By sponsoring and exhibiting in New York and Silicon Valley, you reach a full complement of decision makers and buyers in ...
In today's always-on world, customer expectations have changed. Competitive differentiation is delivered through rapid software innovations, the ability to respond to issues quickly and by releasing high-quality code with minimal interruptions. DevOps isn't some far off goal; it's methodologies and practices are a response to this demand. The demand to go faster. The demand for more uptime. The demand to innovate. In this keynote, we will cover the Nutanix Developer Stack. Built from the foundat...
Two weeks ago (November 3-5), I attended the Cloud Expo Silicon Valley as a speaker, where I presented on the security and privacy due diligence requirements for cloud solutions. Cloud security is a topical issue for every CIO, CISO, and technology buyer. Decision-makers are always looking for insights on how to mitigate the security risks of implementing and using cloud solutions. Based on the presentation topics covered at the conference, as well as the general discussions heard between sessio...
"NetApp's vision is how we help organizations manage data - delivering the right data in the right place, in the right time, to the people who need it, and doing it agnostic to what the platform is," explained Josh Atwell, Developer Advocate for NetApp, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
Sold by Nutanix, Nutanix Mine with Veeam can be deployed in minutes and simplifies the full lifecycle of data backup operations, including on-going management, scaling and troubleshooting. The offering combines highly-efficient storage working in concert with Veeam Backup and Replication, helping customers achieve comprehensive data protection for all their workloads — virtual, physical and private cloud —to meet increasing business demands for uptime and productivity.
The Software Defined Data Center (SDDC), which enables organizations to seamlessly run in a hybrid cloud model (public + private cloud), is here to stay. IDC estimates that the software-defined networking market will be valued at $3.7 billion by 2016. Security is a key component and benefit of the SDDC, and offers an opportunity to build security 'from the ground up' and weave it into the environment from day one. In his session at 16th Cloud Expo, Reuven Harrison, CTO and Co-Founder of Tufin, ...
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
"We were founded in 2003 and the way we were founded was about good backup and good disaster recovery for our clients, and for the last 20 years we've been pretty consistent with that," noted Marc Malafronte, Territory Manager at StorageCraft, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
Historically, some banking activities such as trading have been relying heavily on analytics and cutting edge algorithmic tools. The coming of age of powerful data analytics solutions combined with the development of intelligent algorithms have created new opportunities for financial institutions. In his session at 20th Cloud Expo, Sebastien Meunier, Head of Digital for North America at Chappuis Halder & Co., discussed how these tools can be leveraged to develop a lasting competitive advantage ...
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settl...
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm. In their Day 3 Keynote at 20th Cloud Expo, Chris Brown, a Solutions Marketing Manager at Nutanix, and Mark Lav...
"Cloud computing is certainly changing how people consume storage, how they use it, and what they use it for. It's also making people rethink how they architect their environment," stated Brad Winett, Senior Technologist for DDN Storage, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
A look across the tech landscape at the disruptive technologies that are increasing in prominence and speculate as to which will be most impactful for communications – namely, AI and Cloud Computing. In his session at 20th Cloud Expo, Curtis Peterson, VP of Operations at RingCentral, highlighted the current challenges of these transformative technologies and shared strategies for preparing your organization for these changes. This “view from the top” outlined the latest trends and developments i...