Window Controller is driven via a script that takes multiple parameters. To pass these parameters I use a set of custom functions. You need three: Option, Get Option, and Parameter. You may as well copy Set Option and Result, although they're not used. If you use another way to pass multiple parameters (e.g. the one from SixFriedRice), go on and replace these functions. Only Option and Parameter functions are used by scripts; the Get Option is called by Parameter.
Option( key, value )
Get Option( options, key )
Set Option( options, changed options )
Parameter( key )
Result( key )
Pressed( key code )
Set Contains( set, subset )
Get Original Window Name( window name )
Get Window Suffix( window name )
Window Size Unit
Window Size Zoom
Window Size Status Toolbar
Window Size Status View
Window Size Options
Alignment ID, Name; use the following settings:

Alignment Reference
Alignment Horizontal Proxy
Alignment Horizontal Point
Alignment Vertical Proxy
Alignment Vertical Point
Window Size Name and Alignment Name are used only in the demo file and are not necessary for the controller itself.
Copy Window Size, Window Alignment and Window Settings tables. These are data tables, they don't depend on anything from external tables.
Add a new TO for Window Alignment and call it Default Alignment. Establish a relationship from Window Size::Alignment ID to Default Alignment::ID:
You probably have a single-record table in your applicaiton already. If not, add one; I typically call it System. In order not to break anything we'll copy fields one by one.
Copy and paste User, Item, and Window fields into the System table
Establish a relationship from System::Window to Window Size::Name
Establish a relationship from System::User, System::Window and System::Item to Window Settings::User, Window Settings::Window and Window Settings::Item.
Copy and paste the Alignment field.
Establish a relationship from System::Alignment to Window Alignment::Name
Copy and paste remaining fields: Window Controller, Width, Heihgt, Top, Left, Status Area, Zoom.
Make sure you have layouts System, Window Size, Window Alignment and Window Settings. If you used your own table as System you might need to rename an existing layout; you can rename it back after you paste scripts. Note that layout names are case sensitive.
Switch the Window Size layout into list view and set layout parts to: header: 41 px; body: 106 px; trailing grand summary: 19 px.
Switch the Window Alignment layout into list view and set layout parts to: header: 41 px; body: 121 px; trailing grand summary: 19 px.
Add an empty layout Demo, Test. Link it to Window Size table. Make it blank, small and use some background you like.
Copy and paste script from the following folders:
Copy and paste layout elements from the Window Size layout. Delete the Demo tab.
Copy and paste layout elements from the Window Alignment layout. Delete the Demo tab.
You should be ready to use the controller. The demo file also has a customized menu, but you cannot easily copy it. The menu doesn't contain anything specific, only renamed New Record, Duplicate Record, Delete Record and browse commands commands. The only custom command is Test, but it has a button.
blog comments powered by Disqus