SYS-CON MEDIA Authors: Elizabeth White, Yeshim Deniz, Pat Romanski, Gary Arora, Zakia Bouachraoui

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
Data center, on-premise, public-cloud, private-cloud, multi-cloud, hybrid-cloud, IoT, AI, edge, SaaS, PaaS... it's an availability, security, performance and integration nightmare even for the best of the best IT experts. Organizations realize the tremendous benefits of everything the digital transformation has to offer. Cloud adoption rates are increasing significantly, and IT budgets are morphing to follow suit. But distributing applications and infrastructure around increases risk, introdu...
Most modern computer languages embed a lot of metadata in their application. We show how this goldmine of data from a runtime environment like production or staging can be used to increase profits. Adi conceptualized the Crosscode platform after spending over 25 years working for large enterprise companies like HP, Cisco, IBM, UHG and personally experiencing the challenges that prevent companies from quickly making changes to their technology, due to the complexity of their enterprise. An accomp...
DevOps has long focused on reinventing the SDLC (e.g. with CI/CD, ARA, pipeline automation etc.), while reinvention of IT Ops has lagged. However, new approaches like Site Reliability Engineering, Observability, Containerization, Operations Analytics, and ML/AI are driving a resurgence of IT Ops. In this session our expert panel will focus on how these new ideas are [putting the Ops back in DevOps orbringing modern IT Ops to DevOps].
Atmosera delivers modern cloud services that maximize the advantages of cloud-based infrastructures. Offering private, hybrid, and public cloud solutions, Atmosera works closely with customers to engineer, deploy, and operate cloud architectures with advanced services that deliver strategic business outcomes. Atmosera's expertise simplifies the process of cloud transformation and our 20+ years of experience managing complex IT environments provides our customers with the confidence and trust tha...
SUSE is a German-based, multinational, open-source software company that develops and sells Linux products to business customers. Founded in 1992, it was the first company to market Linux for the enterprise. Founded in 1992, SUSE is the world's first provider of an Enterprise Linux distribution.
Intel is an American multinational corporation and technology company headquartered in Santa Clara, California, in the Silicon Valley. It is the world's second largest and second highest valued semiconductor chip maker based on revenue after being overtaken by Samsung, and is the inventor of the x86 series of microprocessors, the processors found in most personal computers (PCs). Intel supplies processors for computer system manufacturers such as Apple, Lenovo, HP, and Dell. Intel also manufactu...
Artifex Software began 25-years ago with Ghostscript, a page description language (PDL) interpreter software prevalent in printing and related applications requiring rendering and/or conversion from one software language to another. Founded by renowned computer scientist Dr. L. Peter Deutsch, our company has thrived on the basis of our sharp focus on this area of expertise, a zealous commitment to quality and a strong customer service orientation. Over 100 OEM partners representing some of th...
Moving to Azure is the path to digital transformation, but not every journey is effective. Organizations that start with a cohesive, well-planned migration strategy can avoid common mistakes and stay a step ahead of the competition. Learn from Atmosera CEO, Jon Thomsen about the opportunities and challenges found in three pivotal phases of the journey to the cloud: Evaluation and Architecting, Migration and Management, and Optimization & Innovation. In each phase, there are distinct insights tha...
FinTech is a disruptive innovation that denotes the adoption of technologies that have changed how traditional financial services work. While FinTech is now embedded deeply into the financial services ecosystem, the rise of digital age has paved way to FinTech 2.0 - which is rolling out innovative solutions through emerging technologies at a disruptive pace while maintaining the tenets of security and compliances. Blockchain as a technology has started seeing pilot adoption in FinTech around ...
Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation. DX encompasses the continuing technology revolution, and is addressing society's most important issues throughout the entire $78 trillion 21st-century global economy. DXWorldEXPO® has organized these issues along 10 tracks, 22 keynotes and general sessions, and a faculty of 222 of the world's top speakers.
In an age of borderless networks, security for the cloud and security for the corporate network can no longer be separated. Security teams are now presented with the challenge of monitoring and controlling access to these cloud environments, as they represent yet another frontier for cyber-attacks. Complete visibility has never been more important-or more difficult. Powered by AI, Darktrace's Enterprise Immune System technology is the only solution to offer real-time visibility and insight into ...
Alan Hase is Vice President of Engineering and Chief Development Officer at Big Switch. Alan has more than 20 years of experience in the networking industry and leading global engineering teams which have delivered industry leading innovation in high end routing, security, fabric and wireless technologies. Alan joined Big Switch from Extreme Networks where he was responsible for product strategy for its secure campus switching, intelligent mobility and campus orchestration products. Prior to Ext...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Blockchain has shifted from hype to reality across many industries including Financial Services, Supply Chain, Retail, Healthcare and Government. While traditional tech and crypto organizations are generally male dominated, women have embraced blockchain technology from its inception. This is no more evident than at companies where women occupy many of the blockchain roles and leadership positions. Join this panel to hear three women in blockchain share their experience and their POV on the futu...
Financial enterprises in New York City, London, Singapore, and other world financial capitals are embracing a new generation of smart, automated FinTech that eliminates many cumbersome, slow, and expensive intermediate processes from their businesses. Accordingly, attendees at the upcoming 23rd CloudEXPO, June 24-26, 2019 at Santa Clara Convention Center in Santa Clara, CA will find fresh new content in full new FinTech & Enterprise Blockchain track.