The button returns to its original position - how to fix the problem?

 

Hi to all! I have a problem: I created a button and added it and connected it to the dialog object

   if (!dialog.Create( ChartID (),Name, 0 , 10 , 20 , 250 , 300 ))
   {
       Print ( "The panel not create! Error = " , GetLastError ());
   }

   if (button.Create( ChartID (), "Pause" , 0 , 200 , 11 , 224 , 35 ))
   {
      button.BmpOffName( "::Images\\Play.bmp" );
      button.BmpOnName( "::Images\\Pause.bmp" );
   }
  
   dialog.Add(button);
   dialog.Run();

But now in OnChartEvent() (where dialog.ChartEvent() is placed) the button is constantly reset to its original position (not pressed). I need the button to remain unchanged after clicking it until the next click. Can someone tell me how to solve this? Thank you very much!

Reason: