A strange problem on button event

Hi, I use Goo::Canvas wrote a classic game "mine". Everything seem good except a strange problem.

When all mines are found, it calls function win to save time used. But after the dialog destroyed,
the first click seem at wrong place. To reproduce the problem,
 1. set number of mines to 3 or less in menu setting.
 2. clicked in the minefield, it will be very soon to finish it.
 3. after close the dialog, put the mouse on a cell of the table,
please remember the row and column, and click. And compare the row and column with
 the output from the program.
Here is my output:
row, col: (4, 7)
You win!
row, col: (4, 7)
row, col: (1, 2)
row, col: (6, 6)
row, col: (10, 10)
You win!
row, col: (10, 10)
row, col: (3, 10)
You win!
row, col: (3, 10)
row, col: (9, 10)
row, col: (10, 8)
row, col: (7, 10)
You win!
row, col: (7, 10)
row, col: (5, 1)
You win!
row, col: (5, 1)

It seem when the new game start, the first open cell is the last open cell.
If I remove the code to show dialog in the win function(leave only the first five line in the win function),
the problem will not appear.
Is there some function should I call before click the button?

To run the script, you have to install Goo::Canvas. If you using goocanvas-0.6,
please install Goo::Canvas-0.03.
All images used can found in /usr/share/pixmaps/gnomine if you have gnomine installed.
You can set the path in configuration file ~/.perlmine:
   # -*- perl -*-
   # ~/.perlmine
   %Config = (
       'image_directory' => '/usr/share/pixmaps/gnomine',

Best regards,
Ye Wenbin

Attachment: perlmine.pl
Description: Binary data

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]