Re: NSMatrix mouse puzzle

2008-09-04 Thread Graham Cox
On 4 Sep 2008, at 4:14 pm, D.K. Johnston wrote: The reason I want a delay is that the user is supposed to have 10 seconds only to look at the data displayed in the matrix. Then it's cleared. (It's a memory test, to prevent drunks from starting a computer.) I was looking at NSTimer, but i

Re: NSMatrix mouse puzzle

2008-09-03 Thread D.K. Johnston
Thanks for your reply. The "index" variable is actually "i": I forgot to change it when pasting the code into the email. So it does terminate after 10 seconds. The reason I want a delay is that the user is supposed to have 10 seconds only to look at the data displayed in the matrix. Then it

Re: NSMatrix mouse puzzle

2008-09-03 Thread Graham Cox
On 4 Sep 2008, at 2:40 pm, D.K. Johnston wrote: // wait 10 seconds NSUInteger i = 0, resume = time( nil ) + 10; while( i < resume ) index = time( nil ); Don't do this! This is not a good way to wait for a period of time, even if waiting for a perio

NSMatrix mouse puzzle

2008-09-03 Thread D.K. Johnston
I've got a matrix of buttons in a window that I want to disable for a short period, while data is being displayed. So I wrote something like this: [theMatrix setEnabled:NO]; // wait 10 seconds NSUInteger i = 0, resume = time( nil ) + 10; while( i < res