Commit e82ba1f9fa00a373f3695f9a908881dbec6101da

Authored by Carlos Picanco
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
experiment_runner/form_matrixgame.pas
... ... @@ -333,11 +333,12 @@ begin
333 333 ButtonExpCancel.Enabled := not ButtonExpStart.Enabled;
334 334 ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
335 335 FGameControl.Experiment.SaveToFile(OpenDialog.FileName+'.canceled');
336   - FGameControl.SendMessage(K_END);
  336 + FGameControl.Cancel;
337 337 end;
338 338  
339 339 procedure TFormMatrixGame.ButtonExpPauseClick(Sender: TObject);
340 340 begin
  341 + ShowMessage('Não implementado.');
341 342 //ButtonExpStart.Enabled := True;
342 343 //ButtonExpStart.Caption := CAPTION_RESUME;
343 344 //ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
... ...
experiment_runner/units/game_control.pas
... ... @@ -763,7 +763,9 @@ end;
763 763  
764 764 procedure TGameControl.Cancel;
765 765 begin
766   -
  766 + FormMatrixGame.StringGridMatrix.Clean;
  767 + FormMatrixGame.StringGridMatrix.Options := [];
  768 + FZMQActor.SendMessage(K_END);
767 769 end;
768 770  
769 771 // Here FActor is garanted to be a TZMQPlayer
... ...
experiment_runner/units/game_file_methods.pas
... ... @@ -427,8 +427,11 @@ begin
427 427 WriteInteger(LC, KEY_CYCLES_COUNT,Cycles.Count);
428 428 WriteInteger(LC, KEY_CYCLES_VALUE,Cycles.Value);
429 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 436 MI := 0;
434 437 CI := 0;
... ...