Scrolling and Tab Workspaces
Merged changes for the cScrollingClientArea and cDbScrollingClientArea classes to better handle tab workspaces. This also changes how client scrolling works.
-
Changed dialog scrolling logic to make auto-scroll more accurate. The idea behind auto-scrolling is that the scrollbars automatically appear when needed. They do this by looking at all of the child objects and determining the minimum size required to fit them all. When the size gets too small, a scrollbar appears. The determination of minimum size required for scrolling was based on a dialog with scrollbars already present, which distorted the minimum size. This resulted in scrollbars appearing a little sooner than needed. With this change, the scrollbars should appear more appropriately.
-
Changed tab-workspace scrolling logic in dialogs. When tab workspaces are used with views that support scrolling,
pbAutoScrollis now always enabled. When tab workspaces are not used,pbAutoScrollis set to whatever it was. The goal is that the same scrolling-enabled view should work with an application that uses tab workspaces and one that does not. When tab workspaces are enabled, you always want view scrolling. When tab workspaces are not enabled, you have a choice for your view’s behavior. It can either support scrolling or not. If it does not, it acts like our current order entry system. If it does, it acts like the order system with scrolling views. This is controlled by thecScrollingClientArea/cDbScrollingClientArea’spbAutoScrollproperty. By default, this is true, but you can set it to false at design time. This determines scroll behavior when tab workspaces are not used.
So, for example, code like this:
Object oCustomerView is a dbView
Set Border_Style to Border_Thick
Set Label to "Customer Entry View"
Set Location to 7 23
Set Size to 146 277
Set piMinSize to 145 276
Set piMaxSize to 175 450
Object Customer_DD is a Customer_DataDictionary
End_Object // Customer_DD
Set Main_DD to Customer_DD
Set Server to Customer_DD
Object oScrollingContainer1 is a cDbScrollingContainer
Object oScrollingClientArea1 is a cDbScrollingClientArea
// Set pbAutoScroll to False // uncomment and it’s old style, non-scrolling
// but only when tab-workspaces are NOT used
End_Object
End_Object
This same view could be used in an Order Entry system that uses tabbed workspaces and it will scroll. It can also be used in our standard (non-tab-workspace) Order Entry system. If pbAutoScroll is set to False, it acts exactly like our current sample (except it has two nested invisible objects). If True, you get scrolling, which can be kind of nice. The important thing is that the same view can be used everywhere.
You can use the same program to use MDI dialogs or tab workspaces by changing one property, pbTabbedWorkspaces. The only limitation is that you have to set this before you page the command bars. The Studio has the same limitation, which is why you have to restart the Studio if you change this.
More about Scrolling Views
If a view is scrolling-enabled, it means that two child objects have been added to the view (scrolling-container and scrolling client). They are placed between the view object and all window controls. Basically, a scrolling-enabled view can behave in three different ways.
1. No Scroll View / No Tabbed Workspace
- Views don’t scroll and they appear as standard dialogs in an MDI client area. This is classic behavior.
pbAutoScroll = FalseBorder_Style– if border is thick, it’s resizable.Size– determines the initial size of the view.piMinSize– determines the minimum size of the view. If 0, no minimum size.piMaxSize– determines the maximum size of the view. If 0, no maximum size.- Scrolling never happens.
2. Scrolling View / No Tabbed Workspace
- Views scroll but they still appear as standard dialogs in an MDI client area. This mode has been available for a number of versions, although we tend to not show it.
pbAutoScroll = True(the default)Border_Style– if border is thick, it’s resizable.Size– determines the initial size of the view.piMinSize– determines the minimum size of the view. If 0, no minimum size.piMaxSize– determines the maximum size of the view. If 0, no maximum size.- Minimum scrolling is determined by looking at the size and location of all immediate child objects to determine a minimum rectangle size. If the view is sized to a smaller value, scrollbars appear.
3. Scrolling View / Tabbed Workspace
- Views scroll and they appear as tabbed workspace pages.
Border_Style– doesn’t matter. Always resizable according to tab workspace rules.Size– determines the initial size of the view. IfpiMaxSizeis 0, it also determines the maximum size of the view.piMinSize– does nothing.piMaxSize– determines the “maximum” size of the view. If 0, no maximum size.- Minimum scrolling is determined by looking at the size and location of all immediate child objects to determine a minimum rectangle size. If the view is sized to a smaller value, scrollbars appear.
- When a view’s size is greater than the “maximum,” the view’s anchored controls no longer get bigger. If the
pbCenterTabbedViewsproperty of the command bar is True, the object will be centered horizontally and it will be adjusted vertically to provide some space at the top. This gives it a more browser-like appearance.