vcl-dxdashboard-dot-control-dot-tdxcustomdashboardcontrol-48fc103c.md
Allows you to save dashboard/user interaction state changes.
property OnStateChanged: TdxDashboardControlNotifyEvent read; write;
Handle the OnStateChanged event to execute custom code in response to dashboard state changes.
The OnStateChanged event occurs in response to every State property value change (for example, when users resize data visualization items, modify filter criteria, etc.).
The ASender parameter provides access to the TdxDashboardControl component that raised the OnStateChanged event.
The following code example saves the current dashboard user interaction state to a JSON file on every change:
uses
dxDashboard.Control; // Declares the TdxDashboardControl component
// ...
procedure TMyForm.dxDashboardControl1StateChanged(ASender: TdxCustomDashboardControl);
begin
ASender.State.SaveToFile(ASender.DashboardName + 'State.json');
end;
#include "dxDashboard.Control.hpp" // Declares the TdxDashboardControl component
// Add the following linker directive to the corresponding CPP source file:
#pragma link "dxDashboard.Control" // Required to use dxDashboard.Control.hpp declarations
// ...
void __fastcall TMyForm::dxDashboardControl1StateChanged(TdxCustomDashboardControl *ASender)
{
ASender->State->SaveToFile(ASender->DashboardName + "State.json");
}
See Also
TdxCustomDashboardControl.OnLayoutChanged Event
TdxCustomDashboardControl Class