lbcast 发表于 2012-5-22 07:38:33

PowerBuilder 15 Classic Sneak Preview

In my previous article for PowerBuilder Developer's Journal (Vol. 18 issue 8), I gave a sneak preview of some of the things we were working on for PB15 Classic. This is a closer look at one of them - Tabs and Docking in MDI Windows.
Recall that in the article we mentioned adding two new WindowType values - mdidock! and mdidockhelp! - to the window object. Like values mdi! and mdihelp!, respectively, they allow child windows (sheets) to be opened with the OpenSheet functions. But these sheets will behave differently: they can dock, float and be tabbed like the windows you see in our PB.NET IDE.
Your sheets will open docked by default (we will see how to control this later in the article). Once opened, they can be moved, docked in much the same way you can with the PB.NET IDE window. The sheets can be in one of four states:

[*]Tabbed Document: In PB.NET IDE, script editors and window painters are tabbed documents - anything with an entry in the "Window" menu item of the PB.NET IDE (see Figure 1)
[*]Docked: In PB.NET IDE, all other windows, e.g., Toolbox, Solution Explorer, etc.
[*]Floating
[*]Tabbed Windows: Docked windows occupying the same space will be tabbed. The tabs appear at the bottom. Notice that in the PB.NET IDE, the Solution Explorer and Properties Window are usually docked at the same location and appear as windows in a tabbed group. The main differences with tabbed documents are that tabbed windows have tabs at the bottom and have no corresponding entries in the "Windows" menu item.
As in the PB.NET IDE, the opened sheets can be moved, docked, tabbed, and turned into tabbed documents interactively with the mouse. A property will be introduced on child windows to control which states to allow on that window. For example, you may want to prevent the end user from turning a docked window into a document (see Figure 1).
http://res.sys-con.com/story/may12/2268529/fig%201.pngFigure 1Programmatically Opening Sheets in a Specific State
To open a sheet at a specific docking location, in a specific tab group or as a document, we are introducing new versions of the OpenSheet function:

[*]OpenSheetAsDocument
[*]OpenSheetDocked
[*]OpenSheetInTabGroup
[*]OpenSheetWithParmAsDocument
[*]OpenSheetWithParmDocked
[*]OpenSheetWithParmInTabGroup
OpenSheetInTabGroup and OpenSheetWithParmInTabGroup, as their names suggest, open a sheet in a tab group. Unlike the other OpenSheet functions, these take as one of their arguments, not the parent window, but a sibling sheet. These sibling sheets must either be docked or in a tab group.
Persisting MDI State
One of the things you'll notice about the PB.NET IDE is that when you launch it, it restores all the open windows at exactly the same position and state as when you closed it. In PB15 there is going to be an easy way to get the same thing.
The most important thing is to be able to associate a meaningful string ID to each opened sheet. One suggestion - if you use the OpenSheetWithParm family of functions - is to come up with a string representation of the "parm" and be able to convert one from the other. These IDs will be needed either as arguments to the new OpenSheet functions or passed separately using the new SetSheetID function (see Figure 2).
http://res.sys-con.com/story/may12/2268529/fig%202_0.png
Figure 2The MDI state is stored in the registry using the new SaveDockingState function that you'll want to call when your application is closed (see Figure 3).
http://res.sys-con.com/story/may12/2268529/fig%203_0.png
Figure 3When your application is launched, three new functions will help you restore your sheets.
LoadDockingState will fill two equal-sized arrays. One will be an array of type names of persisted sheets. The other will be their corresponding IDs. For these persisted sheets, a new function is introduced to open them: OpenSheetFromDockingState (and OpenSheetWithParmFromDockingState). When all persisted sheets are open, the CommitDocking function will do the work of arranging everything in place and making them visible (see Figure 4).
http://res.sys-con.com/story/may12/2268529/fig%204_0.png
Figure 4Look and Feel
To give you more control over the look and feel of your final application, there will be new properties (see Figures 5-7) to allow you to specify:
http://res.sys-con.com/story/may12/2268529/fig%205a.pnghttp://res.sys-con.com/story/may12/2268529/fig%205b_0.pnghttp://res.sys-con.com/story/may12/2268529/fig%205c_0.pnghttp://res.sys-con.com/story/may12/2268529/fig%205d.pngFigure 5
[*]The colors of active and inactive title bars (horizontal/vertical gradients optional)
[*]The colors of the area behind tabs (horizontal/vertical gradients optional)
[*]The colors of tabs (active/inactive/mouseover); deferring to theme colors is also an option
[*]The shape of tabs
[*]The location of the close button for tabs
[*]Whether to show all tabs (squeezed) or scroll them
http://res.sys-con.com/story/may12/2268529/fig%206a_0_0.pnghttp://res.sys-con.com/story/may12/2268529/fig%206b.pnghttp://res.sys-con.com/story/may12/2268529/fig%206c.pngFigure 6http://res.sys-con.com/story/may12/2268529/fig%207a_0.pnghttp://res.sys-con.com/story/may12/2268529/fig%207b.pnghttp://res.sys-con.com/story/may12/2268529/fig%207c.pngFigure 7Conclusion
The most important thing to remember here is that you can start with an existing MDI application and just change the window type of your main application window. Then start experimenting with the other features - knowing (and comforted by the fact) that the controls within your MDI sheets will continue to behave correctly unchanged. Start planning for the beta!

页: [1]
查看完整版本: PowerBuilder 15 Classic Sneak Preview

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com