$target = "c:\Users\MyName\Desktop\SmartFarmHMI_SOURCE\SmartFarmHMI_FMX\UIrrigation_Impl.inc" $text = Get-Content $target -Encoding UTF8 -Raw # 1. UI Local variables $oldVars = " LHeader, LblEn: TLabel;`r`n SW_En: TSwitch;`r`n EdName: TEdit;`r`n ChkDel: TCheckBox;" $newVars = " LHeader, LblEn, LblSd, LblEd: TLabel;`r`n SW_En: TSwitch;`r`n EdName, EdStartHH, EdStartMM, EdRepeatDays, EdLimitOnesTime: TEdit;`r`n ChkDel: TCheckBox;`r`n DtpSd, DtpEd: TDateEdit;" $text = $text.Replace($oldVars, $newVars) # 2. UI Layout blocks $oldUI = @" LHeader := BuildLabel(Card, '½ºÄÉÁì¸í : ', 20, TAlignLayout.None, claWhite, True); LHeader.SetBounds(80, 16, 100, 30); EdName := TEdit.Create(Self); EdName.Parent := Card; EdName.SetBounds(200, 16, 350, 30); EdName.Text := FIrriSchedules[i].SchedName; EdName.Tag := i; EdName.TagFloat := 1; EdName.StyledSettings := EdName.StyledSettings - [TStyledSetting.Size, TStyledSetting.FontColor]; EdName.TextSettings.Font.Size := 18; {`$IFDEF ANDROID} EdName.TextSettings.FontColor := claWhite; {`$ENDIF} EdName.OnExit := OnIrriScheduleEdit; LblEn := BuildLabel(Card, 'Ȱ¼ºÈ­ :', 20, TAlignLayout.None, claWhite, False); LblEn.SetBounds(620, 16, 80, 30); SW_En := TSwitch.Create(Self); SW_En.Parent := Card; SW_En.SetBounds(730, 16, 80, 30); SW_En.IsChecked := FIrriSchedules[i].Enabled; SW_En.Tag := i; SW_En.TagFloat := 0; SW_En.OnSwitch := OnIrriScheduleEdit; var btnDetail := CreateCustomButton(Card, 'µ¿ÀÛ °ü¸®', TAlignLayout.None, 200, OnIrriActionManageClick); btnDetail.SetBounds(1200, 12, 200, 75); "@ $newUI = @" LHeader := BuildLabel(Card, '½ºÄÉÁì¸í : ', 20, TAlignLayout.None, claLightgray, True); LHeader.SetBounds(80, 16, 100, 30); EdName := TEdit.Create(Self); EdName.Parent := Card; EdName.SetBounds(190, 16, 160, 30); EdName.Text := FIrriSchedules[i].SchedName; EdName.Tag := i; EdName.TagFloat := 1; EdName.StyledSettings := EdName.StyledSettings - [TStyledSetting.Size, TStyledSetting.FontColor]; EdName.TextSettings.Font.Size := 18; {`$IFDEF ANDROID} EdName.TextSettings.FontColor := claWhite; {`$ENDIF} EdName.OnExit := OnIrriScheduleEdit; LblEn := BuildLabel(Card, 'Ȱ¼ºÈ­ :', 20, TAlignLayout.None, claLightgray, False); LblEn.SetBounds(1130, 16, 80, 30); SW_En := TSwitch.Create(Self); SW_En.Parent := Card; SW_En.SetBounds(1130, 60, 80, 30); SW_En.IsChecked := FIrriSchedules[i].Enabled; SW_En.Tag := i; SW_En.TagFloat := 0; SW_En.OnSwitch := OnIrriScheduleEdit; BuildLabel(Card, '½ÃÀÛÀÏÀÚ :', 20, TAlignLayout.None, claLightgray, False).SetBounds(80, 60, 100, 30); DtpSd := BuildDateEdit(Card, FIrriSchedules[i].StartDate, 18, TAlignLayout.None, claBlack, False); DtpSd.SetBounds(190, 60, 160, 30); DtpSd.Tag := i; DtpSd.TagFloat := 2; DtpSd.OnChange := OnIrriScheduleEdit; BuildLabel(Card, 'Á¾·áÀÏÀÚ :', 20, TAlignLayout.None, claLightgray, False).SetBounds(380, 60, 100, 30); DtpEd := BuildDateEdit(Card, FIrriSchedules[i].EndDate, 18, TAlignLayout.None, claBlack, False); DtpEd.SetBounds(490, 60, 160, 30); DtpEd.Tag := i; DtpEd.TagFloat := 3; DtpEd.OnChange := OnIrriScheduleEdit; BuildLabel(Card, '¹Ýº¹ÁÖ±â(ÀÏ) :', 20, TAlignLayout.None, claLightgray, False).SetBounds(380, 16, 130, 30); EdRepeatDays := TEdit.Create(Self); EdRepeatDays.Parent := Card; EdRepeatDays.SetBounds(600, 16, 50, 30); EdRepeatDays.TextSettings.Font.Size := 18; EdRepeatDays.MaxLength := 2; EdRepeatDays.Text := Format('%.d', [FIrriSchedules[i].RepeatDays]); EdRepeatDays.StyledSettings := EdRepeatDays.StyledSettings - [TStyledSetting.Size, TStyledSetting.FontColor]; EdRepeatDays.FilterChar := '0123456789'; {`$IFDEF ANDROID} EdRepeatDays.TextSettings.FontColor := claWhite; {`$ENDIF} EdRepeatDays.TagFloat := 6; EdRepeatDays.Tag := i; EdRepeatDays.OnExit := OnIrriScheduleEdit; BuildLabel(Card, '1ȸ´ç Á¦Çѽð£(ºÐ) :', 20, TAlignLayout.None, claLightgray, False).SetBounds(680, 16, 200, 30); EdLimitOnesTime := TEdit.Create(Self); EdLimitOnesTime.Parent := Card; EdLimitOnesTime.SetBounds(890, 16, 50, 30); EdLimitOnesTime.TextSettings.Font.Size := 18; EdLimitOnesTime.MaxLength := 3; EdLimitOnesTime.Text := Format('%.d', [FIrriSchedules[i].LimitOnesTimeMin]); EdLimitOnesTime.StyledSettings := EdLimitOnesTime.StyledSettings - [TStyledSetting.Size, TStyledSetting.FontColor]; EdLimitOnesTime.FilterChar := '0123456789'; {`$IFDEF ANDROID} EdLimitOnesTime.TextSettings.FontColor := claWhite; {`$ENDIF} EdLimitOnesTime.TagFloat := 7; EdLimitOnesTime.Tag := i; EdLimitOnesTime.OnExit := OnIrriScheduleEdit; BuildLabel(Card, '½ÃÀ۽ð£ :', 20, TAlignLayout.None, claLightgray, False).SetBounds(680, 60, 130, 30); EdStartHH := TEdit.Create(Self); EdStartHH.Parent := Card; EdStartHH.SetBounds(825, 60, 50, 30); EdStartHH.TextSettings.Font.Size := 18; EdStartHH.MaxLength := 2; EdStartHH.Text := Format('%.2d', [FIrriSchedules[i].StartHH]); EdStartHH.StyledSettings := EdStartHH.StyledSettings - [TStyledSetting.Size, TStyledSetting.FontColor]; EdStartHH.FilterChar := '0123456789'; {`$IFDEF ANDROID} EdStartHH.TextSettings.FontColor := claWhite; {`$ENDIF} EdStartHH.TagFloat := 4; EdStartHH.Tag := i; EdStartHH.OnExit := OnIrriScheduleEdit; BuildLabel(Card, ':', 18, TAlignLayout.None, claWhite, True).SetBounds(880, 60, 10, 30); EdStartMM := TEdit.Create(Self); EdStartMM.Parent := Card; EdStartMM.SetBounds(890, 60, 50, 30); EdStartMM.TextSettings.Font.Size := 18; EdStartMM.MaxLength := 2; EdStartMM.Text := Format('%.2d', [FIrriSchedules[i].StartMM]); EdStartMM.StyledSettings := EdStartMM.StyledSettings - [TStyledSetting.Size, TStyledSetting.FontColor]; EdStartMM.FilterChar := '0123456789'; {`$IFDEF ANDROID} EdStartMM.TextSettings.FontColor := claWhite; {`$ENDIF} EdStartMM.TagFloat := 5; EdStartMM.Tag := i; EdStartMM.OnExit := OnIrriScheduleEdit; var btnDetail := CreateCustomButton(Card, 'µ¿ÀÛ °ü¸®', TAlignLayout.None, 160, OnIrriActionManageClick); btnDetail.SetBounds(1240, 8, 160, 84); "@ $text = $text.Replace($oldUI, $newUI) # 3. Field IDs $oldFields = @" case FieldID of 0: if Sender is TSwitch then FIrriSchedules[Idx].Enabled := (Sender as TSwitch).IsChecked; 1: if Sender is TEdit then FIrriSchedules[Idx].SchedName := (Sender as TEdit).Text; 2: if Sender is TDateEdit then FIrriSchedules[Idx].StartDate := (Sender as TDateEdit).Date; 3: if Sender is TDateEdit then FIrriSchedules[Idx].EndDate := (Sender as TDateEdit).Date; end; "@ $newFields = @" case FieldID of 0: if Sender is TSwitch then FIrriSchedules[Idx].Enabled := (Sender as TSwitch).IsChecked; 1: if Sender is TEdit then FIrriSchedules[Idx].SchedName := (Sender as TEdit).Text; 2: if Sender is TDateEdit then FIrriSchedules[Idx].StartDate := (Sender as TDateEdit).Date; 3: if Sender is TDateEdit then FIrriSchedules[Idx].EndDate := (Sender as TDateEdit).Date; 4: if Sender is TEdit then FIrriSchedules[Idx].StartHH := StrToIntDef((Sender as TEdit).Text, 0) mod 24; 5: if Sender is TEdit then FIrriSchedules[Idx].StartMM := StrToIntDef((Sender as TEdit).Text, 0) mod 60; 6: if Sender is TEdit then FIrriSchedules[Idx].RepeatDays := StrToIntDef((Sender as TEdit).Text, 1); 7: if Sender is TEdit then FIrriSchedules[Idx].LimitOnesTimeMin := StrToIntDef((Sender as TEdit).Text, 0); end; "@ $text = $text.Replace($oldFields, $newFields) # 4. Filters $text = $text.Replace("EdDelay.OnExit := OnIrriActionEdit;", "EdDelay.FilterChar := '0123456789';`r`n EdDelay.OnExit := OnIrriActionEdit;") $text = $text.Replace("EdTimeout.OnExit := OnIrriActionEdit;", "EdTimeout.FilterChar := '0123456789';`r`n EdTimeout.OnExit := OnIrriActionEdit;") $text = $text.Replace("eVal.OnExit := OnIrriActionEdit;", "eVal.FilterChar := '0123456789.';`r`n eVal.OnExit := OnIrriActionEdit;") Set-Content $target -Value $text -Encoding UTF8