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

Re: [MacPerl-Toolbox] QuickDraw and MacWindows



At 9:47 am -0400 27/06/00, Quentin Smith wrote:

>In the subroutine DRAWING, change $draw = $str; into $draw = eval "sub
>  $str }";
>In the subroutine WINDOW, where the redraw hook is defined, change
>val( $draw ) into &{ $draw }

That certainly doesn't work as set out, even with the obvious typos put right.

A slight modification does work however:

     eval "sub draw {$str}";            # in EasyWindow::DRAWING
     $win->sethook('redraw', \&draw);   # in EasyWindow::WINDOW

I am lost for a test to demonstrate how much of an improvement it 
might be over the original. Presumably (?) the eval() is not now 
called in an 'update' event, but how important is that anyway? Anyone 
know?

At 11:34 am -0400 27/06/00, Kevin Reid wrote:

>sub DRAWING (&) {
>   my ($sub) = @_;
>   &$sub; # or save it for later
>}

This retrieves '$sub' as a CODE reference to the block of QuickDraw 
text -- yes?  On the face of it, it looks likely the reference could 
be used directly in the 'redraw' hook. However I have quite failed to 
find a way to make that work. I suspect '&$sub' behaves as the 
original text string, not a functioning sub-routine. At any rate 
"print &$sub" merely returns the original, unadorned text string.

Alan Fry

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org