[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Re: GUI Modules



Matthias writes:

>I simply hadn't defined this access method yet (and I suppose it speaks well
>of the intuitiveness of my interfacing that you expected it to be there in
>exactly this way). As a workaround, the following might work:
>
>use Mac::Memory;
>
>@PicHandle::ISA = qw(Handle);
>
>sub PicHandle::picFrame {
>   my($my) = @_;
>   bless $my->get(2,8), "Rect";
>}

I've changed the script to:

	use Mac::Events;
	use Mac::Windows;
	use Mac::QuickDraw;
	use Mac::Resources;
	use Mac::Memory;
	
	@PicHandle::ISA = qw(Handle);
	
	$eps = "Edge 2000:Desktop Folder:test.eps";
	$res = OpenResFile($eps) or die ^$E;
	$pict = GetPicture(256);
	$imageRect = $pict->picFrame;
	#$imageRect = new Rect 10, 10, 250, 250;
	
	$bounds = new Rect 50, 50, 550, 290;
	$win = new MacWindow $bounds, "Draw Pict Resource", 1, documentProc, 1;
	$win->sethook("redraw", \&DrawOurWindow);
	WaitNextEvent while $win->window;
	dispose $win;
	
	CloseResFile($res);
	
	sub DrawOurWindow {
		DrawPicture $pict, $imageRect;
	}
	
	sub PicHandle::picFrame {
		my($my) = @_;
		bless $my->get(2,8), "Rect";
	}

When it executes the bless statement, I encounter the following error message:

	hand is not of type Handle.

I assume this means that $my needs to be blessed to "Handle", but I can't seem to
get that to work for me either.

Any suggestions would be greatly appreciated.

Kevin