The scheduler did not execute as expected

Home Forums kbmMW The scheduler did not execute as expected

Viewing 1 reply thread
  • Author
    Posts
    • #57526
      TomYU
      Participant

      hi,kim

      The first time starting SE is executed and then stopping SE is called, in this case, when starting SE is executed again, the scheduler does not execute.

      code:
      unit Form.Main;

      type
      TForm18 = class(TForm)

      private
      KeepLiveScheduledEvent :IkbmMWScheduledEvent;

      procedure CreateSE;
      procedure StartSE;
      procedure StopSE;
      public
      { Public declarations }
      end;

      var
      Form18: TForm18;

      implementation

      {$R *.fmx}

      { TForm18 }

      procedure TForm18.CCButton1Click(Sender: TObject);
      begin
      StartSE;
      end;

      procedure TForm18.CCButton2Click(Sender: TObject);
      begin
      StopSE;
      end;

      procedure TForm18.CreateSE;
      begin
      KeepLiveScheduledEvent := Scheduler.Schedule(
      function(const AScheduledEvent: IkbmMWScheduledEvent): Boolean
      begin
      TThread.Synchronize(nil,procedure
      begin
      Text1.Text:= FormatDateTime(‘yyyy-mm-dd hh:nn:ss’,Now);
      end)
      end)
      .EverySecond(1);
      end;

      procedure TForm18.FormCreate(Sender: TObject);
      begin
      CreateSE;
      end;

      procedure TForm18.StartSE;
      begin
      KeepLiveScheduledEvent.Activate(True);
      end;

      procedure TForm18.StopSE;
      begin
      KeepLiveScheduledEvent.Activate(False);
      end;

      end.

    • #57527
      TomYU
      Participant

      kbmMW Version: 5.23.00

Viewing 1 reply thread
  • You must be logged in to reply to this topic.