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

[MacPerl] RE:



You might consider making a dialog with nine push buttons.  It should be
easy to lay out the dialog in a resource editor, set up callbacks for the
buttons and invoke it with ModalDialog.  The state of a square would of
course be indicated by the label of the button.  It wouldn't be the most
beautiful tic-tac-toe interface ever, but it would be relatively easy and
functional.

-----Original Message-----
From: Darryl Tang [mailto:darryl@yoshisonline.com]
Sent: Thursday, June 17, 1999 8:24 AM
To: macperl@macperl.org
Subject: 



I'm working on a little programming exercise with my kids - tic tac toe -
to learn more about MacPerl.  We've worked out the logic pretty well and
are now moving on to developing a graphical interface of sorts.

We want to put up a window with a tic tac toe grid and then let the human
player click on the spot where he/she wants to move.  We've figured out how
to draw the window and grid, by looking at the MacPerl Power and Ease Book
and Inside Macintosh (very briefly).  We're stuck now because we can't
figure out how to make the program respond to the human player's mouse
click on the appropriate spot.

We think that what we need is a subroutine that is hooked onto the window
and called when a mouse event is detected.  The subroutine would put an "x"
or "o" in the spot where the mouse was clicked.  We think it would look
something like this:

	$win->sethook('mouseUp' => \&handlemouseroutine);

Unfortunately, this didn't work.  Anyone have any ideas?  More generally,
anyone know of a source of examples on using the Mac GUI interface in
MacPerl?

Thanks!

Darryl Tang


_________________________________________________________

Yoshi's Franchise Corporation
of America, Inc.

http://www.yoshisonline.com








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

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