New Splitter implementation

[h]Alternative Xojo Splitter Code[/h]

The following code should be viewed in conjunction with my screen shots previously posted. You can find (and optionally download) them here:

Click on “SB Screen Shots” at the top left-hand-side of the page and, if asked for a p/w, it is the same thing (omitting the quotes). Note that these are .png files; if you need a different format (for example, if you can’t resize them without blurring the images), please e-Mail request to: review.bucket@captiverelease.com

Also please note that this short code does not claim to be particularly elegant and its use of Public variables is not necessarily best practice; it is merely a test to demonstrate that the concept and paradigm work.

Global Variables:
Public Property gInitialABWidth as Integer
Public Property gInitialABHeight as Integer
Public Property gInitialCBHeight as Integer
Public Property gInitialCBWidth as Integer
Public Property gInitialNBHeight as Integer
Public Property gInitialNBWidth as Integer
Public Property gInitialSBHeight as Integer
Public Property gInitialSBWidth as Integer

Public Property gRelativePSValue as Single

MainWindow Code:
	MainWindow.Open:
// Set application's window size to occupy two-thirds of maximum available:
self.Width = Screen.ScreenAt(0).AvailableWidth / 3 * 2
self.Height = Screen.ScreenAt(0).AvailableHeight / 3 * 2

// Centre it:
Self.Left = (Screen.ScreenAt(0).AvailableWidth - Self.Width) / 2
Self.Top = (Screen.ScreenAt(0).AvailableHeight - Self.Height) / 2

// Position Navigator and Control boxes, taking three-quarters
// and one-quarter respectively of left-hand-side of screen:
NavigatorBox.Width = 171 'Arbitary left-right break
NavigatorBox.Height = self.Height / 4 * 3

ControlBox.Width = NavigatorBox.Width
ControlBox.Top = NavigatorBox.Height
ControlBox.Height = self.Height - NavigatorBox.Height - 5 '(Allow a 5-unit border cushion at bottom)

// Position Analyses and Sand boxes, each
// taking half of right-hand-side of screen:
AnalysesBox.Width = self.Width - NavigatorBox.Width - 8 ' (Allow an 8-unit border cushion at right)
AnalysesBox.Height = self.Height / 2

SandBox.Width = AnalysesBox.Width
SandBox.Top = AnalysesBox.Height
SandBox.Height = AnalysesBox.Height - 4 '(Allow a 4 unit cushion at bottom)

// Preserve the dimensions for use by other routines . . .
gInitialNBWidth = NavigatorBox.Width
gInitialNBHeight = NavigatorBox.Height

gInitialCBWidth = ControlBox.Width
gInitialCBHeight = ControlBox.Height

gInitialABWidth = AnalysesBox.Width
gInitialABHeight = AnalysesBox.Height

gInitialSBWidth = SandBox.Width
gInitialSBHeight = SandBox.Height

	MainWindow.Resizing:
// If window is being resized, ensure Navigator and Control Boxes don't recede:
If NavigatorBox.Width < gInitialNBWidth then NavigatorBox.Width = gInitialNBWidth
If ControlBox.Width < gInitialCBWidth then ControlBox.Width = gInitialCBWidth


Slider Control (Name: PaneSplitter, Allow Live Scrolling: On)
// Convert Pane Splitter slider value to a floating point value between 0 and 1:
gRelativePSValue = PaneSplitter.Value / PaneSplitter.MaximumValue

// Adjust right-hand window space accordingly:
AnalysesBox.Height = gInitialABHeight * gRelativePSValue * 2
SandBox.Top = AnalysesBox.Height
SandBox.Height = self.Height - SandBox.Top - 5 '(Allow a 5-unit border cushion at bottom)