Commit 46b2a955833dd55a0531e36312d2f86e68605238
1 parent
10aade72
Exists in
master
fix bug on load contingencies
Showing
2 changed files
with
40 additions
and
34 deletions
Show diff stats
experiment_designer/form_main.lfm
@@ -554,6 +554,7 @@ object FormDesigner: TFormDesigner | @@ -554,6 +554,7 @@ object FormDesigner: TFormDesigner | ||
554 | ChildSizing.ControlsPerLine = 1 | 554 | ChildSizing.ControlsPerLine = 1 |
555 | ClientHeight = 583 | 555 | ClientHeight = 583 |
556 | ClientWidth = 650 | 556 | ClientWidth = 650 |
557 | + Enabled = False | ||
557 | object ComboCurrentContingency: TComboBox | 558 | object ComboCurrentContingency: TComboBox |
558 | Left = 0 | 559 | Left = 0 |
559 | Height = 27 | 560 | Height = 27 |
experiment_designer/form_main.pas
@@ -351,6 +351,7 @@ begin | @@ -351,6 +351,7 @@ begin | ||
351 | ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; | 351 | ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; |
352 | RGPointsClick(RGPoints); | 352 | RGPointsClick(RGPoints); |
353 | RGEndCriteriaStyleClick(RGEndCriteriaStyle); | 353 | RGEndCriteriaStyleClick(RGEndCriteriaStyle); |
354 | + TabSheetContingencies.Enabled := ComboCurrentCondition.Items.Count > 0; | ||
354 | end; | 355 | end; |
355 | 356 | ||
356 | procedure TFormDesigner.XMLPropStorageSavingProperties(Sender: TObject); | 357 | procedure TFormDesigner.XMLPropStorageSavingProperties(Sender: TObject); |
@@ -871,40 +872,44 @@ end; | @@ -871,40 +872,44 @@ end; | ||
871 | procedure TFormDesigner.LoadSectionCondition(LS: string); | 872 | procedure TFormDesigner.LoadSectionCondition(LS: string); |
872 | begin | 873 | begin |
873 | with FExperiment do | 874 | with FExperiment do |
874 | - begin | ||
875 | - EditConditionName.Text := ReadString(LS, KEY_COND_NAME, LS); | ||
876 | - SpinEditTurnValue.Value := ReadInteger(LS, KEY_TURN_VALUE, 2); | ||
877 | - SpinEditOnConditionBegin.Value := ReadInteger(LS, KEY_POINTS_ONSTART,0); | ||
878 | - SpinEditCyclesValue.Value := ReadInteger(LS, KEY_CYCLES_VALUE, 2); | ||
879 | - | ||
880 | - CheckBoxShouldAskQuestion.Checked := False; | ||
881 | - if ValueExists(LS, KEY_PROMPT_STYLE) and ValueExists(LS, KEY_PROMPT_MESSAGE) then | ||
882 | begin | 875 | begin |
883 | - EditQuestion.Text := ReadString(LS, KEY_PROMPT_MESSAGE, ''); | ||
884 | - SetCGQuestion(ReadString(LS, KEY_PROMPT_STYLE, '')); | ||
885 | - if (EditQuestion.Text <> '') or (ReadString(LS, KEY_PROMPT_STYLE, '') <> '') then | ||
886 | - CheckBoxShouldAskQuestion.Checked := True; | ||
887 | - end; | 876 | + EditConditionName.Text := ReadString(LS, KEY_COND_NAME, LS); |
877 | + SpinEditTurnValue.Value := ReadInteger(LS, KEY_TURN_VALUE, 2); | ||
878 | + SpinEditOnConditionBegin.Value := ReadInteger(LS, KEY_POINTS_ONSTART,0); | ||
879 | + SpinEditCyclesValue.Value := ReadInteger(LS, KEY_CYCLES_VALUE, 2); | ||
888 | 880 | ||
889 | - SetRGEndCriteriaStyle(ReadString(LS, KEY_ENDCRITERIA, 'O QUE OCORRER PRIMEIRO')); | ||
890 | - SpinEditEndCriteriaAbsCycles.Value := ReadInteger(LS, KEY_ENDCRITERIA_CYCLES, 20); | ||
891 | - SpinEditEndCriteriaLastCycles.Value := | ||
892 | - GetEndCriteriaLastCyclesFromString(ReadString(LS, KEY_ENDCRITERIA_PORCENTAGE, '80,20')); | ||
893 | - SpinEditEndCriteriaInterlockingPorcentage.Value := | ||
894 | - GetEndCriteriaPorcentageFromString(ReadString(LS, KEY_ENDCRITERIA_PORCENTAGE, '80,20')); | ||
895 | - end; | 881 | + CheckBoxShouldAskQuestion.Checked := False; |
882 | + if ValueExists(LS, KEY_PROMPT_STYLE) and ValueExists(LS, KEY_PROMPT_MESSAGE) then | ||
883 | + begin | ||
884 | + EditQuestion.Text := ReadString(LS, KEY_PROMPT_MESSAGE, ''); | ||
885 | + SetCGQuestion(ReadString(LS, KEY_PROMPT_STYLE, '')); | ||
886 | + if (EditQuestion.Text <> '') or (ReadString(LS, KEY_PROMPT_STYLE, '') <> '') then | ||
887 | + CheckBoxShouldAskQuestion.Checked := True; | ||
888 | + end; | ||
889 | + | ||
890 | + SetRGEndCriteriaStyle(ReadString(LS, KEY_ENDCRITERIA, 'O QUE OCORRER PRIMEIRO')); | ||
891 | + SpinEditEndCriteriaAbsCycles.Value := ReadInteger(LS, KEY_ENDCRITERIA_CYCLES, 20); | ||
892 | + SpinEditEndCriteriaLastCycles.Value := | ||
893 | + GetEndCriteriaLastCyclesFromString(ReadString(LS, KEY_ENDCRITERIA_PORCENTAGE, '80,20')); | ||
894 | + SpinEditEndCriteriaInterlockingPorcentage.Value := | ||
895 | + GetEndCriteriaPorcentageFromString(ReadString(LS, KEY_ENDCRITERIA_PORCENTAGE, '80,20')); | ||
896 | + end; | ||
896 | end; | 897 | end; |
897 | 898 | ||
898 | procedure TFormDesigner.LoadContingency(LS, LC: string); | 899 | procedure TFormDesigner.LoadContingency(LS, LC: string); |
900 | +var | ||
901 | + Temp: String; | ||
899 | begin | 902 | begin |
903 | + CheckBoxIsMeta.OnChange := nil; | ||
900 | if Pos(KEY_METACONTINGENCY, LC) > 0 then | 904 | if Pos(KEY_METACONTINGENCY, LC) > 0 then |
901 | CheckBoxIsMeta.Checked := True | 905 | CheckBoxIsMeta.Checked := True |
902 | else | 906 | else |
903 | CheckBoxIsMeta.Checked := False; | 907 | CheckBoxIsMeta.Checked := False; |
904 | - | 908 | + CheckBoxIsMeta.OnChange:=@CheckBoxIsMetaChange; |
905 | with FExperiment do | 909 | with FExperiment do |
906 | if ValueExists(LS, LC + KEY_CONSEQUE) and ValueExists(LS, LC + KEY_CRITERIA) then | 910 | if ValueExists(LS, LC + KEY_CONSEQUE) and ValueExists(LS, LC + KEY_CRITERIA) then |
907 | begin | 911 | begin |
912 | + Temp := ReadString(LS, LC + KEY_CONT_NAME, ''); | ||
908 | EditContingencyName.Text := ReadString(LS, LC + KEY_CONT_NAME, ''); | 913 | EditContingencyName.Text := ReadString(LS, LC + KEY_CONT_NAME, ''); |
909 | SetContingencyCriteria(ReadString(LS, LC + KEY_CRITERIA, '')); | 914 | SetContingencyCriteria(ReadString(LS, LC + KEY_CRITERIA, '')); |
910 | SetContingencyStyle(ReadString(LS, LC + KEY_CONSEQUE, '')); | 915 | SetContingencyStyle(ReadString(LS, LC + KEY_CONSEQUE, '')); |
@@ -1057,6 +1062,7 @@ begin | @@ -1057,6 +1062,7 @@ begin | ||
1057 | ComboCurrentCondition.ItemIndex := i; | 1062 | ComboCurrentCondition.ItemIndex := i; |
1058 | SaveSectionCondition(SEC_CONDITION + IntToStr(i + 1)); | 1063 | SaveSectionCondition(SEC_CONDITION + IntToStr(i + 1)); |
1059 | ListBoxConditions.Items.Text := ComboCurrentCondition.Items.Text; | 1064 | ListBoxConditions.Items.Text := ComboCurrentCondition.Items.Text; |
1065 | + TabSheetContingencies.Enabled := ComboCurrentCondition.Items.Count > 0; | ||
1060 | end; | 1066 | end; |
1061 | 1067 | ||
1062 | procedure TFormDesigner.BtnAppendContingencyClick(Sender: TObject); | 1068 | procedure TFormDesigner.BtnAppendContingencyClick(Sender: TObject); |
@@ -1124,6 +1130,7 @@ begin | @@ -1124,6 +1130,7 @@ begin | ||
1124 | ComboCurrentCondition.ItemIndex := i -1; | 1130 | ComboCurrentCondition.ItemIndex := i -1; |
1125 | end; | 1131 | end; |
1126 | ListBoxContingencies.Items.Text := ComboCurrentCondition.Items.Text; | 1132 | ListBoxContingencies.Items.Text := ComboCurrentCondition.Items.Text; |
1133 | + TabSheetContingencies.Enabled := ComboCurrentCondition.Items.Count > 0; | ||
1127 | end; | 1134 | end; |
1128 | 1135 | ||
1129 | procedure TFormDesigner.BtnRemoveContingencyClick(Sender: TObject); | 1136 | procedure TFormDesigner.BtnRemoveContingencyClick(Sender: TObject); |
@@ -1259,19 +1266,17 @@ begin | @@ -1259,19 +1266,17 @@ begin | ||
1259 | LabelIf.Caption := 'SE O PARTICIPANTE ESCOLHER'; | 1266 | LabelIf.Caption := 'SE O PARTICIPANTE ESCOLHER'; |
1260 | end; | 1267 | end; |
1261 | 1268 | ||
1262 | - | ||
1263 | - if Sender = CheckBoxIsMeta then | ||
1264 | - if ComboCurrentCondition.Items.Count > 0 then | ||
1265 | - if ComboCurrentContingency.Items.Count > 0 then | ||
1266 | - begin | ||
1267 | - LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']); | ||
1268 | - LC := ExtractDelimited(1, ComboCurrentContingency.Text,['|']); | ||
1269 | - EraseContingency(LS,LC); | ||
1270 | - LC := GetLC(TCheckBox(Sender).Checked,False); | ||
1271 | - SaveContingency(LS,LC); | ||
1272 | - ComboCurrentContingency.Items[ComboCurrentContingency.ItemIndex] := LC +'|'+ EditContingencyName.Text; | ||
1273 | - ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; | ||
1274 | - end; | 1269 | + if ComboCurrentCondition.Items.Count > 0 then |
1270 | + if ComboCurrentContingency.Items.Count > 0 then | ||
1271 | + begin | ||
1272 | + LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']); | ||
1273 | + LC := ExtractDelimited(1, ComboCurrentContingency.Text,['|']); | ||
1274 | + EraseContingency(LS,LC); | ||
1275 | + LC := GetLC(TCheckBox(Sender).Checked,False); | ||
1276 | + SaveContingency(LS,LC); | ||
1277 | + ComboCurrentContingency.Items[ComboCurrentContingency.ItemIndex] := LC +'|'+ EditContingencyName.Text; | ||
1278 | + ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; | ||
1279 | + end; | ||
1275 | end; | 1280 | end; |
1276 | 1281 | ||
1277 | procedure TFormDesigner.CheckBoxColorsRowsChange(Sender: TObject); | 1282 | procedure TFormDesigner.CheckBoxColorsRowsChange(Sender: TObject); |