Kevin Reid in his fascinating clock program 29 Oct 1998 10:14:14 -0500 asks along the way: > # Anybody know how to write a round WDEF? Here are two adaptations of the example Matthias gives in 'CustomWindow.t'. 'CircDef_1' is just a round window. 'CircDef_2' has a border by which the window can be dragged. #!perl use Mac::Events; use Mac::Windows; use Mac::QuickDraw; $bnd = new Rect 50, 50, 150, 150; $win = new MacWindow $bnd, '', 1, \&CircDef_1, 1; $win->sethook('redraw', \&draw_window); $win->sethook('click', sub{$OK = 1}); WaitNextEvent while $win->window and !$OK; dispose $win; sub draw_window { TextSize 24; $len = StringWidth 'HELLO'; MoveTo 50 - int($len/2), 60; DrawString 'HELLO'; } sub CircDef_1 { my($variant, $win, $msg, $param) = @_; if ($msg == wNew) {;} elsif ($msg == wCalcRgns) { my($r) = OffsetRect($win->portRect, -$win->portBits->bounds->left, -$win->portBits->bounds->top ); my $circ = NewRgn(); OpenRgn; FrameOval $r; CloseRgn $circ; CopyRgn $circ, $win->contRgn; CopyRgn $circ, $win->strucRgn; } elsif ($msg == wHit) { if (PtInRgn($param, $win->contRgn)) { return wInContent; } } return 0; } sub CircDef_2 { my($variant, $win, $msg, $param) = @_; if ($msg == wNew) {;} elsif ($msg == wCalcRgns) { my($cont_r) = OffsetRect($win->portRect, -$win->portBits->bounds->left, -$win->portBits->bounds->top ); my($struc_r) = InsetRect($cont_r, -6, -6); my $circ = NewRgn(); OpenRgn; FrameOval $cont_r; CloseRgn $circ; CopyRgn $circ, $win->contRgn; $circ = NewRgn(); OpenRgn; FrameOval $struc_r; CloseRgn $circ; CopyRgn $circ, $win->strucRgn; } elsif ($msg == wDraw) { my($frame) = DiffRgn $win->strucRgn, $win->contRgn; EraseRgn $frame; ForeColor redColor; PaintRgn $frame; ForeColor blackColor; #FrameRgn $frame; } elsif ($msg == wHit) { my($r) = $win->strucRgn->rgnBBox; if (PtInRgn($param, DiffRgn($win->strucRgn, $win->contRgn))) { return wInDrag; } elsif (PtInRgn($param, $win->contRgn)) { return wInContent; } } return 0; } Alan Fry ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch