DISCLAIMER - AGREEMENT
The author (Lindsay Mathieson) hereby disclaims all warranties relating to this software, whether
express or implied, including without limitation any implied warranties of merchantability
or fitness for  particular purpose. The author will not be liable for any special,
incidental, consequential, indirect or similar damages due to loss of data or any other
reason, even if the author or an agent of the author has been advised
of the possibility of such damages.  The person using the software bears all risk
as to the quality and performance of the software.
Reading or downloading of this document consitutes agreement of these terms.

REGISTRATION:
There is none - you have full liecense to copy, modify or use this source
as desired. If you distribute this software you *MUST* distribute this
file in unmodified form with it.

POSTCARDWARE:
This is postcardware, if it has been useful to you, try and send a interesting
postcard to:
	Lindsay Mathieson
	22 Chapel Hill Rd
	Chapel Hill
	Brisbane 4069
	Australia

Please - no soft porn cards, it upsets the teddies.


Version:
========
vs 1.1

History:
========
1.0	- Initial Cut
1.1 -
	*	Changed so enabling was done via HWND's rather than TControl *, so
		no need for OWL interface element.
	*	Added word wrap to balloon help
	*	Added auto sizing/placement of controls, via AnchorRight,AnchorDown,
		GrowRight,GrowDown constraints
1.2	-
	*	Added Disabled Help
	*	Added EV_CONTROL_ENABLE
1.3 -	Added many more Size Constraints

Demo:
=====
Load enable.ide & run it for a demo

Files to include in your project:
=================================
enabledl.cpp & enabledl.h

Classes:
========

TMixInEnableDialog:
-------------------
MixIn class to add Idle Processing/Command Enabling/Ballon Help/Auto Size & Placement
to existing dialogs

TEnableDialog:
-------------
Base enable dialog class, can be used as a base for new classes.

These two classes are derived from Ian Spencers Begin/EndModal encapsulation
that enables modal dialogs to process idle message & Bob Arson's article in
Windows/DOS Developers Journal (Vol6, No 1) on OWL command enablers for
controls in dialogs, plus some extra stuff of my own! (Balloon help,AutoSize).

All this enables modal dialogs to process idle messages.

Command Enabling:
=================
Now any control in a dialog can have a Command Enabler associated with it.
Just add a EV_CONTROL_ENABLE macro in the response table,
e.g.

DEFINE_RESPONSE_TABLE1(TTestDialog, TEnableDialog)
	EV_CONTROL_ENABLE(IDOK,CeOk),
END_RESPONSE_TABLE;

// TEnableDialog constructor....
{
	....
	new TButton(this,IDOK);
	....
};


void TTestDialog::CeOk(TCommandEnabler& ce)
{
	BOOL enable = IsDlgButtonChecked(IDC_ENABLEOK) &&
		::GetWindowTextLength(GetDlgItem(IDC_AMOUNT)) > 0;
	ce.Enable(enable);
};

And the Ok button will be automatically enabled/disabled as the dialog is edited.


Balloon Help:
=============
Now any control can have Ballon Help (a.k.a. Macintosh System 7) popup as
the mouse moves over it. This help can be any length and multiline.
Word breaking is performed as neccessary, line breaks can be forced with
"\r\n"
You don't need a OWL interface element for the control, but you do need a
Id for it.
e.g.

// TEnableDialog constructor....
{
	....
	AddHelp(IDOK,
		"Ok\r\nDont Press this until 'Enable Ok' is checked and "\
		"Amount is filled in");
	....
}

Auto Size & Placement:
======================
Now your dialog (MDI or otherwise) can automatically size & place its controls
based on simple constraints you specify, much easier than TLayoutWindow.
Once again, you don't need a OWL interface element for the control, but you do need a
Id for it.
The constraints are:
	AnchorRight - control is fixed relative to parent right border
	AnchorRight - control is fixed relative to parent bottom border
	GrowRight	- control size grows so right border of control is
				  fixed relative to the parents right border
	GrowDown	- control size grows so bottom border of control is
				  fixed relative to the parents bottom border

	AnchorVertCenter
				- Anchor relative to the center of the horiz axis.
	AnchorHorizCenter
				- Anchor relative to the center of the vert axis
	AnchorHorizPercent
				- Anchor on the Horiz Axis on a percentage basis
	AnchorVertPercent
				- Anchor on the Vertical Axis on a percentage basis
	GrowHorizPercent
				- Grow on the Horiz Axis on a percentage basis
	GrowVertPercent
				- Grow on the Vertical Axis on a percentage basis
	LeftOf		- Anchor control relative to a nominated controls LHS
				  e.g. AddSize(IDC_LABEL,LeftOf,IDC_EDIT);
	RightOf		- Anchor control relative to a nominated controls RHS
	GrowLeftOf	- adjusts right side of control relative to a nominated controls LHS
				  null control means parent dialog
				  e.g. AddSize(IDC_EDIT1,GrowLeftOf,IDC_EDIT2);

These contraints are calculated based on the initial layout of the dialog. Just
use the AddSize(<ControlId>,<constraint> [,<ControlId2> = -1]) method in your dialogs constructor.
<ControlId2> (optional) is used for LeftOf, RightOf & GrowLeftOf
e.g.
// TEnableDialog constructor....
{
	....
	AddSize(IDHELP,AnchorDown | AnchorRight);

	AddSize(109,GrowRight);
	AddSize(IDC_AMOUNT,GrowRight | GrowDown);
	....
}

NOTE: Invalid combinations of Constraints are: (i.e. don't make sense)
	AnchorRight | GrowRight;
	AnchorDown | GrowDown;
Anything else is OK.

Future:
=======
balloon help loading from resources via RCDATA statements, based
on the Dialog & Control Id, plus writing a editor for this.

Thanks:
=======
Ian Spencers for the Idle <wg> dialogs.
Bob Arnson for the command enabling
Steve Saxon for the generally excellent propdlg & tfarry's

I welcome feedback, critiques & suggestions.
Contact me (via the forum please) on 100060,1147
Lindsay Mathieson
