Commit e82ba1f9fa00a373f3695f9a908881dbec6101da
1 parent
25375db8
Exists in
master
implement naive cancel button
Workflow as follows: - Researcher press the cancel button; - The current state of the experiment is saved automagically. The experiment can be resumed by loading the saved file. - All participants are informed about the end of the experiment - All participant's instances are closed
Showing
3 changed files
with
10 additions
and
4 deletions
Show diff stats
experiment_runner/form_matrixgame.pas
@@ -333,11 +333,12 @@ begin | @@ -333,11 +333,12 @@ begin | ||
333 | ButtonExpCancel.Enabled := not ButtonExpStart.Enabled; | 333 | ButtonExpCancel.Enabled := not ButtonExpStart.Enabled; |
334 | ButtonExpPause.Enabled := not ButtonExpStart.Enabled; | 334 | ButtonExpPause.Enabled := not ButtonExpStart.Enabled; |
335 | FGameControl.Experiment.SaveToFile(OpenDialog.FileName+'.canceled'); | 335 | FGameControl.Experiment.SaveToFile(OpenDialog.FileName+'.canceled'); |
336 | - FGameControl.SendMessage(K_END); | 336 | + FGameControl.Cancel; |
337 | end; | 337 | end; |
338 | 338 | ||
339 | procedure TFormMatrixGame.ButtonExpPauseClick(Sender: TObject); | 339 | procedure TFormMatrixGame.ButtonExpPauseClick(Sender: TObject); |
340 | begin | 340 | begin |
341 | + ShowMessage('Não implementado.'); | ||
341 | //ButtonExpStart.Enabled := True; | 342 | //ButtonExpStart.Enabled := True; |
342 | //ButtonExpStart.Caption := CAPTION_RESUME; | 343 | //ButtonExpStart.Caption := CAPTION_RESUME; |
343 | //ButtonExpPause.Enabled := not ButtonExpStart.Enabled; | 344 | //ButtonExpPause.Enabled := not ButtonExpStart.Enabled; |
experiment_runner/units/game_control.pas
@@ -763,7 +763,9 @@ end; | @@ -763,7 +763,9 @@ end; | ||
763 | 763 | ||
764 | procedure TGameControl.Cancel; | 764 | procedure TGameControl.Cancel; |
765 | begin | 765 | begin |
766 | - | 766 | + FormMatrixGame.StringGridMatrix.Clean; |
767 | + FormMatrixGame.StringGridMatrix.Options := []; | ||
768 | + FZMQActor.SendMessage(K_END); | ||
767 | end; | 769 | end; |
768 | 770 | ||
769 | // Here FActor is garanted to be a TZMQPlayer | 771 | // Here FActor is garanted to be a TZMQPlayer |
experiment_runner/units/game_file_methods.pas
@@ -427,8 +427,11 @@ begin | @@ -427,8 +427,11 @@ begin | ||
427 | WriteInteger(LC, KEY_CYCLES_COUNT,Cycles.Count); | 427 | WriteInteger(LC, KEY_CYCLES_COUNT,Cycles.Count); |
428 | WriteInteger(LC, KEY_CYCLES_VALUE,Cycles.Value); | 428 | WriteInteger(LC, KEY_CYCLES_VALUE,Cycles.Value); |
429 | WriteInteger(LC, KEY_CYCLES_GEN,Cycles.Generation); | 429 | WriteInteger(LC, KEY_CYCLES_GEN,Cycles.Generation); |
430 | - WriteString(LC, KEY_PROMPT_MESSAGE, Prompt.Question); | ||
431 | - WriteString(LC, KEY_PROMPT_STYLE, GetPromptStyleString(Prompt.PromptStyle)); | 430 | + if Assigned(Prompt) then |
431 | + begin | ||
432 | + WriteString(LC, KEY_PROMPT_MESSAGE, Prompt.Question); | ||
433 | + WriteString(LC, KEY_PROMPT_STYLE, GetPromptStyleString(Prompt.PromptStyle)); | ||
434 | + end; | ||
432 | 435 | ||
433 | MI := 0; | 436 | MI := 0; |
434 | CI := 0; | 437 | CI := 0; |