V0.2.2.0: work-in-progress. Triggerform initial display, save and load functioning.

ToDo: Verification of inputs and ErrorList.  Update main app upon triggerform save

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5618 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2017-01-10 06:04:45 +00:00
parent fe93b37050
commit 2ab3b46c78
3 changed files with 123 additions and 82 deletions

View File

@ -10,7 +10,7 @@
<IsPartOfProject Value="True"/>
<EditorIndex Value="12"/>
<CursorPos Y="35"/>
<UsageCount Value="148"/>
<UsageCount Value="149"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -21,7 +21,7 @@
<ResourceBaseClass Value="Form"/>
<TopLine Value="511"/>
<CursorPos X="25" Y="516"/>
<UsageCount Value="148"/>
<UsageCount Value="149"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@ -34,7 +34,7 @@
<EditorIndex Value="7"/>
<TopLine Value="33"/>
<CursorPos X="41" Y="45"/>
<UsageCount Value="138"/>
<UsageCount Value="139"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit2>
@ -44,7 +44,7 @@
<EditorIndex Value="1"/>
<TopLine Value="13"/>
<CursorPos X="49" Y="20"/>
<UsageCount Value="130"/>
<UsageCount Value="131"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
@ -54,15 +54,15 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="130"/>
<UsageCount Value="131"/>
</Unit4>
<Unit5>
<Filename Value="..\foobot_utility.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="9"/>
<TopLine Value="241"/>
<CursorPos X="31" Y="243"/>
<UsageCount Value="148"/>
<CursorPos X="68" Y="261"/>
<UsageCount Value="149"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
@ -72,7 +72,7 @@
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="130"/>
<UsageCount Value="131"/>
</Unit6>
<Unit7>
<Filename Value="foobot_sensors.pas"/>
@ -80,7 +80,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="299"/>
<CursorPos X="14" Y="321"/>
<UsageCount Value="82"/>
<UsageCount Value="83"/>
</Unit7>
<Unit8>
<Filename Value="usplash.pas"/>
@ -90,7 +90,7 @@
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="3"/>
<CursorPos X="48" Y="37"/>
<UsageCount Value="77"/>
<UsageCount Value="78"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit8>
@ -102,9 +102,9 @@
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<TopLine Value="151"/>
<CursorPos X="44" Y="165"/>
<UsageCount Value="68"/>
<TopLine Value="135"/>
<CursorPos X="18" Y="165"/>
<UsageCount Value="69"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit9>
@ -113,7 +113,7 @@
<EditorIndex Value="8"/>
<TopLine Value="43"/>
<CursorPos X="47" Y="13"/>
<UsageCount Value="89"/>
<UsageCount Value="90"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
@ -121,7 +121,7 @@
<EditorIndex Value="11"/>
<TopLine Value="141"/>
<CursorPos X="31" Y="148"/>
<UsageCount Value="89"/>
<UsageCount Value="90"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
@ -192,7 +192,7 @@
<EditorIndex Value="5"/>
<TopLine Value="101"/>
<CursorPos Y="154"/>
<UsageCount Value="40"/>
<UsageCount Value="41"/>
<Loaded Value="True"/>
</Unit21>
<Unit22>
@ -221,14 +221,14 @@
<EditorIndex Value="10"/>
<TopLine Value="381"/>
<CursorPos X="13" Y="384"/>
<UsageCount Value="58"/>
<UsageCount Value="59"/>
<Loaded Value="True"/>
</Unit25>
<Unit26>
<Filename Value="..\latest_stable\udataform.pas"/>
<EditorIndex Value="6"/>
<TopLine Value="70"/>
<UsageCount Value="58"/>
<UsageCount Value="59"/>
<Loaded Value="True"/>
</Unit26>
<Unit27>
@ -272,7 +272,7 @@
<EditorIndex Value="4"/>
<TopLine Value="1811"/>
<CursorPos X="13" Y="1834"/>
<UsageCount Value="36"/>
<UsageCount Value="37"/>
<Loaded Value="True"/>
</Unit32>
<Unit33>
@ -287,123 +287,123 @@
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="utriggersform.pas"/>
<Caret Line="229" TopLine="178"/>
<Caret Line="21" Column="18"/>
</Position1>
<Position2>
<Filename Value="umainform.pas"/>
<Caret Line="362" Column="22" TopLine="349"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="153" Column="20" TopLine="130"/>
</Position2>
<Position3>
<Filename Value="umainform.pas"/>
<Caret Line="539" Column="42" TopLine="524"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="92" Column="20" TopLine="90"/>
</Position3>
<Position4>
<Filename Value="utriggersform.pas"/>
<Caret Line="14" Column="5"/>
<Filename Value="umainform.pas"/>
<Caret Line="397" Column="17" TopLine="378"/>
</Position4>
<Position5>
<Filename Value="utriggersform.pas"/>
<Caret Line="12" Column="15"/>
<Filename Value="umainform.pas"/>
<Caret Line="745" Column="44" TopLine="698"/>
</Position5>
<Position6>
<Filename Value="utriggersform.pas"/>
<Caret Line="13" Column="26"/>
<Filename Value="umainform.pas"/>
<Caret Line="832" Column="44" TopLine="785"/>
</Position6>
<Position7>
<Filename Value="utriggersform.pas"/>
<Caret Line="21" Column="18"/>
<Caret Line="138" TopLine="103"/>
</Position7>
<Position8>
<Filename Value="utriggersform.pas"/>
<Caret Line="153" Column="20" TopLine="130"/>
<Caret Line="137" Column="52" TopLine="110"/>
</Position8>
<Position9>
<Filename Value="utriggersform.pas"/>
<Caret Line="92" Column="20" TopLine="90"/>
<Caret Line="123" Column="8" TopLine="105"/>
</Position9>
<Position10>
<Filename Value="umainform.pas"/>
<Caret Line="397" Column="17" TopLine="378"/>
<Caret Line="279" Column="11" TopLine="261"/>
</Position10>
<Position11>
<Filename Value="umainform.pas"/>
<Caret Line="745" Column="44" TopLine="698"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="153" Column="43" TopLine="134"/>
</Position11>
<Position12>
<Filename Value="umainform.pas"/>
<Caret Line="832" Column="44" TopLine="785"/>
<Caret Line="78" Column="9" TopLine="45"/>
</Position12>
<Position13>
<Filename Value="utriggersform.pas"/>
<Caret Line="138" TopLine="103"/>
<Filename Value="umainform.pas"/>
<Caret Line="417" Column="39" TopLine="370"/>
</Position13>
<Position14>
<Filename Value="utriggersform.pas"/>
<Caret Line="137" Column="52" TopLine="110"/>
<Filename Value="umainform.pas"/>
<Caret Line="419" Column="39" TopLine="372"/>
</Position14>
<Position15>
<Filename Value="utriggersform.pas"/>
<Caret Line="123" Column="8" TopLine="105"/>
<Filename Value="umainform.pas"/>
<Caret Line="884" Column="32" TopLine="837"/>
</Position15>
<Position16>
<Filename Value="umainform.pas"/>
<Caret Line="279" Column="11" TopLine="261"/>
<Caret Line="1062" Column="28" TopLine="1015"/>
</Position16>
<Position17>
<Filename Value="utriggersform.pas"/>
<Caret Line="153" Column="43" TopLine="134"/>
<Filename Value="umainform.pas"/>
<Caret Line="77" TopLine="51"/>
</Position17>
<Position18>
<Filename Value="umainform.pas"/>
<Caret Line="78" Column="9" TopLine="45"/>
<Caret Line="3" Column="7"/>
</Position18>
<Position19>
<Filename Value="umainform.pas"/>
<Caret Line="417" Column="39" TopLine="370"/>
<Caret Line="30" Column="20" TopLine="28"/>
</Position19>
<Position20>
<Filename Value="umainform.pas"/>
<Caret Line="419" Column="39" TopLine="372"/>
<Caret Line="883" Column="65" TopLine="852"/>
</Position20>
<Position21>
<Filename Value="umainform.pas"/>
<Caret Line="884" Column="32" TopLine="837"/>
<Caret Line="1080" Column="61" TopLine="1036"/>
</Position21>
<Position22>
<Filename Value="umainform.pas"/>
<Caret Line="1062" Column="28" TopLine="1015"/>
<Filename Value="..\foobot_utility.pas"/>
<Caret Line="277" TopLine="241"/>
</Position22>
<Position23>
<Filename Value="umainform.pas"/>
<Caret Line="77" TopLine="51"/>
<Caret Line="476" Column="65" TopLine="457"/>
</Position23>
<Position24>
<Filename Value="umainform.pas"/>
<Caret Line="3" Column="7"/>
<Caret Line="448" Column="8" TopLine="445"/>
</Position24>
<Position25>
<Filename Value="umainform.pas"/>
<Caret Line="30" Column="20" TopLine="28"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="171" Column="16" TopLine="135"/>
</Position25>
<Position26>
<Filename Value="umainform.pas"/>
<Caret Line="883" Column="65" TopLine="852"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="285" Column="79" TopLine="244"/>
</Position26>
<Position27>
<Filename Value="umainform.pas"/>
<Caret Line="1080" Column="61" TopLine="1036"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="287" Column="88" TopLine="245"/>
</Position27>
<Position28>
<Filename Value="..\foobot_utility.pas"/>
<Caret Line="277" TopLine="241"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="275" Column="17" TopLine="260"/>
</Position28>
<Position29>
<Filename Value="umainform.pas"/>
<Caret Line="476" Column="65" TopLine="457"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="161" Column="22" TopLine="150"/>
</Position29>
<Position30>
<Filename Value="umainform.pas"/>
<Caret Line="448" Column="8" TopLine="445"/>
<Filename Value="utriggersform.pas"/>
<Caret Line="162" Column="16" TopLine="130"/>
</Position30>
</JumpHistory>
</ProjectSession>

View File

@ -1,7 +1,7 @@
object triggersform: Ttriggersform
Left = 808
Left = 2283
Height = 565
Top = 146
Top = 82
Width = 794
ActiveControl = edt_newrec_pm
BorderIcons = [biSystemMenu]
@ -863,7 +863,6 @@ object triggersform: Ttriggersform
Default = True
DefaultCaption = True
Kind = bkOK
ModalResult = 1
OnClick = cmd_OKClick
TabOrder = 1
end

View File

@ -106,6 +106,7 @@ type
procedure SetUpUnits;
function AssignAndSaveTriggers:boolean;
function AssignAndSaveRecommendedLevels:boolean;
function AllInputsVerified:Boolean;
public
end;
@ -136,11 +137,31 @@ procedure Ttriggersform.FormActivate(Sender: TObject);
begin
SetUpUnits;
end;
procedure Ttriggersform.FormShow(Sender: TObject);
begin
Caption := Application.Title + ' - Set Recommended values (for all Foobots) and Triggers (for ' +
FoobotIdentityObject.FoobotIdentityList[mainform.iCurrentFoobot].Name + ')';
DisplayCurrentValues;
ErrorList.Clear;
Update;
end;
// *****************************************************************************
procedure Ttriggersform.cmd_OKClick(Sender: TObject);
begin
// VerifyEveryThing then Save to inifiles;
AssignAndSaveTriggers;
IF AssignAndSaveTriggers
AND AssignAndSaveRecommendedLevels
AND AllInputsVerified then
begin
ModalResult:=mrClose;
Close;
end
else
begin
ModalResult:=mrNone;
ShowMessage('Wont close');
end;
end;
procedure Ttriggersform.OnlyNumericKeyPressInteger(Sender: TObject; var Key: char);
@ -153,14 +174,11 @@ begin
if not (Key in ['0'..'9', '.', #8, #9]) then Key := #0;
end;
procedure Ttriggersform.FormShow(Sender: TObject);
function Ttriggersform.AllInputsVerified:Boolean;
begin
Caption := Application.Title + ' - Set Recommended values (for all Foobots) and Triggers (for ' +
FoobotIdentityObject.FoobotIdentityList[mainform.iCurrentFoobot].Name + ')';
DisplayCurrentValues;
ErrorList.Clear;
Update;
Result:=TRUE;
end;
function Ttriggersform.AssignAndSaveTriggers:boolean;
begin
Result:=FALSE;
@ -210,23 +228,23 @@ begin
{$ENDIF}
// Recommended levels
lbl_currentrec_pm.Caption :=
Format('Current recommended level: %.1f %s', [double(REC_PM),
Format('Current recommended level: %.1f %s', [RecommendedLevelsArray[C_PM],
FoobotDataObject.Units[C_PM]]);
lbl_currentrec_tmp.Caption :=
Format('Current recommended level: %.1f %s', [double(REC_TMP),
Format('Current recommended level: %.1f %s', [RecommendedLevelsArray[C_TMP],
FoobotDataObject.Units[C_TMP]]);
lbl_currentrec_hum.Caption :=
Format('Current recommended level: %.1f %s', [double(REC_HUM),
Format('Current recommended level: %.1f %s', [RecommendedLevelsArray[C_HUM],
FoobotDataObject.Units[C_HUM]]);
lbl_currentrec_co2.Caption :=
Format('Current recommended level: %.0f %s', [double(REC_CO2),
Format('Current recommended level: %.0f %s', [RecommendedLevelsArray[C_CO2],
FoobotDataObject.Units[C_CO2]]);
lbl_currentrec_voc.Caption :=
Format('Current recommended level: %.0f %s', [double(REC_VOC),
Format('Current recommended level: %.0f %s', [RecommendedLevelsArray[C_VOC],
FoobotDataObject.Units[C_VOC]]);
lbl_currentrec_allpollu.Caption :=
Format('Current recommended level: %.1f %s',
[double(REC_ALLPOLLU), FoobotDataObject.Units[C_ALLPOLLU]]);
[RecommendedLevelsArray[C_ALLPOLLU], FoobotDataObject.Units[C_ALLPOLLU]]);
// Trigger highs
lbl_currenthightrigger_pm.Caption :=
Format('Current high trigger: %.1f %s',
@ -266,6 +284,30 @@ begin
lbl_currentlowtrigger_allpollu.Caption :=
Format('Current low trigger: %.1f %s',
[double(FooBotTriggerArray[C_LOW, C_ALLPOLLU]), FoobotDataObject.Units[C_ALLPOLLU]]);
// Assign Edit control values
// Recommended
edt_newrec_pm.Text:=Format('%.1f', [RecommendedLevelsArray[C_PM]]);
edt_newrec_tmp.Text:=Format('%.1f', [RecommendedLevelsArray[C_TMP]]);
edt_newrec_hum.Text:=Format('%.1f', [RecommendedLevelsArray[C_HUM]]);
edt_newrec_co2.Text:=Format('%.0f', [RecommendedLevelsArray[C_CO2]]);
edt_newrec_voc.Text:=Format('%.0f', [RecommendedLevelsArray[C_VOC]]);
edt_newrec_allpollu.Text:=Format('%.1f', [RecommendedLevelsArray[C_ALLPOLLU]]);
// HighTrigger
edt_newhightrigger_pm.Text:=Format('%.1f',[double(FooBotTriggerArray[C_HIGH, C_PM])]);
edt_newhightrigger_tmp.Text:=Format('%.1f',[double(FooBotTriggerArray[C_HIGH, C_TMP])]);
edt_newhightrigger_hum.Text:=Format('%.1f',[double(FooBotTriggerArray[C_HIGH, C_HUM])]);
edt_newhightrigger_co2.Text:=Format('%.0f',[double(FooBotTriggerArray[C_HIGH, C_CO2])]);
edt_newhightrigger_voc.Text:=Format('%.0f',[double(FooBotTriggerArray[C_HIGH, C_VOC])]);
edt_newhightrigger_allpollu.Text:=Format('%.1f',[double(FooBotTriggerArray[C_HIGH, C_ALLPOLLU])]);
// LowTrigger
edt_newlowtrigger_pm.Text:=Format('%.1f',[double(FooBotTriggerArray[C_LOW, C_PM])]);
edt_newlowtrigger_tmp.Text:=Format('%.1f',[double(FooBotTriggerArray[C_LOW, C_TMP])]);
edt_newlowtrigger_hum.Text:=Format('%.1f',[double(FooBotTriggerArray[C_LOW, C_HUM])]);
edt_newlowtrigger_co2.Text:=Format('%.0f',[double(FooBotTriggerArray[C_LOW, C_CO2])]);
edt_newlowtrigger_voc.Text:=Format('%.0f',[double(FooBotTriggerArray[C_LOW, C_VOC])]);
edt_newlowtrigger_allpollu.Text:=Format('%.1f',[double(FooBotTriggerArray[C_LOW, C_ALLPOLLU])]);
end;
procedure Ttriggersform.SetUpUnits;