[comp.sys.mac.programmer] MacApp multiple views in a window problem

luke@tasis.utas.oz (Luke Visser) (04/27/89)

Ok I've tried just about everything to fix this and
can't work it out.  The situation is that I want to put
multiple frames into one window.  That's ok the problem
comes when the event is processed.  The target view gets
it first but the other view never gets a look in.

I've tried setting the nexthandler so that the other view
should get checked but nothing seems to work.

Anyway here's the code, can anyone spot the solution:

procedure TXDocument.DoMakeViews(forPrinting: boolean); override;
var
	aTEView : TTEView;
begin
	New(aTEView);
	FailNIL(aTEView);
	aTEView.ITEView(nil, self, fListText, Point(0), cTyping, 5, 4, 30,
		100, applFont, 12, [], sizeFixed, sizeFixed, kUnlimited);
	fListTEView := aTEView;

	New(aTEView);
	FailNIL(aTEView);
	aTEView.ITEView(nil, self, fpersonText, Point(0), cTyping, 5, 4, 400,
		500, applFont, 12, [], sizeFixed, sizeFixed, kUnlimited);
	fpersonTEView := aTEView;
end;


procedure TXDocument.DoMakeWindows; override;
var
	aWmgrWindow : WindowPtr;
	aWindow : TWindow;
	canResize, canClose : boolean;
	r : Rect;
	listFrame, personFrame : TFrame;
begin
	aWmgrWindow := gApplication.GetRsrcWindow(nil, kWindowRsrc,
		not kDialogWindow, canResize, canClose);
	FailNIL(aWmgrWindow);
	New(aWindow);
	FailNIL(aWindow);
	aWindow.IWindow(self, aWmgrWindow, not KDialogWindow, canResize,
		canClose, true);
		
	SetRect(r, 0, 0, 100, 100);
	New(listFrame);
	FailNIL(listFrame);
	listFrame.IFrame(aWindow, aWindow, r, not kWantHScrollBar,
		kWantVScrollBar, not kHFrResize, kVFrResize);
	listFrame.HaveView(fListTEView);
	
	SetRect(r, 116, 0, 300, 100);
	New(personFrame);
	FailNIL(personFrame);
	personFrame.IFrame(fListTEView, aWindow, r, not kWantHScrollBar,
		kWantVScrollBar, kHFrResize, kVFrResize);
 	personFrame.HaveView(fpersonTEView);

	aWindow.fTarget := fpersonTEView;
	SimpleStagger(aWindow, kStaggerAmount, kStaggerAmount, gStaggerCount);
end;

Thank's muchly

Luke Visser
---------------------------------------------------------------------------
"I'm a Tasmanian"	- Albert Einstein
Snail: Uni of Tasmania, Box 252C GPO, Hobart 7001, Tasmania, Australia.
ACSnet: luke@tasis.utas.oz	ARPA: luke%tasis.utas.oz@uunet.uu.net
UUCP: {enea,hplabs,mcvax,uunet,ukc}!munnari!tasis.utas.oz!luke

lsr@Apple.COM (Larry Rosenstein) (04/29/89)

In article <1002@tasis.utas.oz> luke@tasis.utas.oz (Luke Visser) writes:

> multiple frames into one window.  That's ok the problem
> comes when the event is processed.  The target view gets
> it first but the other view never gets a look in.

I don't see anything wrong with your code.  Your target chain should go 
from the person TEView, to its Frame, to the list TEView, to its Frame, to 
theWindow, ...

There may be something funny going on within MacApp, but nothing comes to 
mind immediately.  I tried looking to see where the target and 
fNextHandler fields are changed, but didn't find anything.

I think you should use the MacApp debugger to see how the target chain 
ends up.  You can display the current gTarget by typing 'I gTarget' to the 
debugger.  Then you can start tracing the target chain back.  Knowing 
what's in the chain would help track down where it is getting messed up.

Let me know if you need more help.  (I tried mailing to you but wasn't 
successful.)

Larry Rosenstein, Apple Computer, Inc.
Object Specialist

Internet: lsr@Apple.com   UUCP: {nsc, sun}!apple!lsr
AppleLink: Rosenstein1