[comp.sys.mac.programmer] MacApp2.0b5

ralph@computing-maths.cardiff.ac.uk (Ralph Martin) (12/05/88)

I've got a problem with Views in resources in MacApp2.0b5, which I'm
not sure if its a bug, or just me doing something wrong. I seem to
follow the templates in the manual, but here's the problem.

Ive got a window, in which are 2 views, a dialog which covers the whole
window, and has lots of edittext items and things in it, and a curveview (my
own type, simple enough) which covers just part of the window. When the window
is first drawn, only the curveview stuff gets drawn, and none of the edittext
or other dialog items. Resizing the window etc. then cause the dialog items
to appear. Why aren't the dialog items visible straight away?

Any help, RTFMs, or whatever gratefully received.

Below are my DoMakeViews, and the view reources:
================================================
PROCEDURE TCurveDocument.DoMakeViews(forPrinting: BOOLEAN); OVERRIDE;
	VAR aCurveView:		TCurveView;
		aCurveWindow:	TCurveWindow;
		theDialog:		TDialogView;
		aStdPrintHandler:	TStdPrintHandler;
	BEGIN
	IF forPrinting THEN BEGIN
	aCurveView := TCurveView(DoCreateViews(SELF, NIL, kCurveViewID));
	fCurveView := aCurveView;
	END
	ELSE BEGIN
	aCurveWindow := TCurveWindow(NewTemplateWindow(kCurveWindowID, SELF));
	fCurveView := TCurveView(aCurveWindow.FindSubView('CURV'));
	theDialog := TDialogView(aCurveWindow.FindSubView('DLOG'));
	theDialog.SelectEditText('XMIN', TRUE);
	END;
	fCurveView.fCurveDocument := SELF;

	New(aStdPrintHandler);
	FailNil(aStdPrintHandler);
	aStdPrintHandler.IStdPrintHandler(SELF,fCurveView,TRUE,TRUE,TRUE);
	END;
===========================================================================
resource 'view' (1001,purgeable) {
	{
	root, 'WIND',{50, 40}, {250, 450},
	sizeVariable,sizeVariable,shown,enabled,
	Window {"TCurveWindow", zoomDocProc,goAwayBox,resizable,modeless,
		ignoreFirstClick,freeOnClosing,disposeOnFree,closesDocument,
		openWithDocument,dontAdaptToScreen,stagger,forceOnScreen,
			dontCenter,'CURV',""};
	
	'WIND', 'DLOG',	{ 0, 0 }, {0,0},
	sizeSuperView, sizeSuperView, shown, enabled,
	DialogView {"TCurveDialog", noID, noID };

	'DLOG',noID,{0, 0}, {25,100},
	sizeFixed, sizeFixed, shown,enabled,
	Button {"TButton",adnRRect, {3, 3}, sizeable, notDimmed, notHilited,
		doesntDismiss,	{ 4, 4, 4, 4 }, plain, 10, {0, 0, 0}, "a",
		 "Draw Curve" };
	
	'DLOG',noID,{30,0},{20,100},
	sizeFixed, sizeFixed, shown,disabled,
	StaticText {"TStaticText",adnNone, {1, 1}, sizeable,
		notDimmed, notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a",
	justLeft, "Xmin" };

	'DLOG','XMIN',{50,0},{20,100},
	sizeFixed, sizeFixed, shown,enabled,
	EditText {"TEditText",adnFrame, {1, 1}, sizeable, notDimmed,
		notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a",
		justRight, "Initial 1", 255, ArrowsAndBackspace };
	
	'DLOG',noID,{70,0},{20,100},
	sizeFixed, sizeFixed, shown,disabled,
	StaticText {"TStaticText",adnNone, {1, 1}, sizeable,
		notDimmed, notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a",
		justLeft, "Xmax" };

	'DLOG','XMAX',{90,0},{20,100},
	sizeFixed, sizeFixed, shown,enabled,
	EditText {"TEditText",adnFrame, {1, 1}, sizeable, notDimmed,
		notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a",
		justRight, "Initial 2", 255, ArrowsAndBackspace };
	
	'DLOG',noID,{110,0},{20,100},
	sizeFixed, sizeFixed, shown,disabled,
	StaticText {"TStaticText",adnNone, {1, 1}, sizeable,
		notDimmed, notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a",
		justLeft, "Ymin" };

	'DLOG','YMIN',{130,0},{20,100},
	sizeFixed, sizeFixed, shown,enabled,
	EditText {"TEditText",adnFrame, {1, 1}, sizeable, notDimmed,
		notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a", justRight,
		"Initial 3", 255, ArrowsAndBackspace };
	
	'DLOG',noID,{150,0},{20,100},
	sizeFixed, sizeFixed, shown,disabled,
	StaticText {"TStaticText",adnNone, {1, 1}, sizeable,
		notDimmed, notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a",
		justLeft, "Ymax" };

	'DLOG','YMAX',{170,0},{20,100},
	sizeFixed, sizeFixed, shown,enabled,
	EditText {"TEditText",adnFrame, {1, 1}, sizeable, notDimmed,
		notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a", justRight,
		"Initial 4", 255, ArrowsAndBackspace };
	
	'DLOG',noID,{0,100},{20,50},
	sizeFixed, sizeFixed, shown,disabled,
	StaticText {"TStaticText",adnNone, {1, 1}, sizeable,
		notDimmed, notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a", justLeft, "Equation" };

	'DLOG','EQN ',{0,150},{20,100},
	sizeFixed, sizeFixed, shown,enabled,
	EditText {"TEditText",adnFrame, {1, 1}, sizeable, notDimmed,
		notHilited, doesntDismiss,
		{2, 2, 2, 2}, plain,10, {0,0,0}, "a", justLeft, "The
		Equation", 255, ArrowsAndBackspace };
	
	'WIND',IncludeViews {1002}
	}
};

resource 'view' (1002,purgeable) {
	{
	'WIND','CURV',{20,100},{230,350},
	sizeRelSuperView,sizeRelSuperView,shown,disabled,
	View {"TCurveView"}
	
	}
};


-- 
Dr Ralph Martin
Department of Computing Mathematics
University of Wales College of Cardiff
PO Box 916
Cardiff
CF2 4YN
United Kingdom