vendredi 27 février 2015

Component editor doesn't immediately prompt for saving new property values


Vote count:

0




I have a custom control which has a component editor (two different screens available through two different context menu items). In both these instances, when I change properties of the component it's editing, the IDE does not acknowledge that any changes have been made, and thus the "Save All" button in the Delphi IDE remains inactive (assuming it was inactive prior to changes).


Although the property changes have clearly been applied on the design-time control, if I immediately run the project, the changes done from the component editor haven't been applied in runtime. I've had to make minor tweaks in the form designer / object inspector to trigger the "Save All" button to become enabled, so I can actually save the changes.


Here's how I execute the context menu selection:


TMyControlEditor descends from TDefaultEditor



implementation

procedure TMyControlEditor.ExecuteVerb(Index: Integer);
begin
case Index of
0: begin
ExecEditor;
end;
1: begin
ConvertFromControl;
end;
end;
end;

procedure TMyControlEditor.ExecEditor;
var
F: TfrmMyControlEditor;
begin
//Executes the actual component editor window to modify properties
F:= TfrmMyControlEditor.Create(TMyControl(Component));
try
case F.ShowModal of
mrOK: begin
//Save the modified control properties to original control
F.SaveTo(TMyControl(Component));
end;
else begin
//Cancelled
end;
end;
finally
F.Free;
end;
end;

procedure TfrmMyControlEditor.SaveTo(ADst: TMyControl);
begin
ADst.ThisProperty:= chkThisProperty.Checked;
ADst.ThatProperty:= txtThatProperty.Text;
ADst.Width:= seWidth.Value;
ADst.Height:= seHeight.Value;
ADst.Enabled:= chkEnabled.Checked;
ADst.Visible:= chkVisible.Checked;
... set other properties ...
end;


This even happens with properties which I do not even reintroduce, such as Visible or Width. If I change any property from this property editor, it does immediately show me that change in the Object Inspector. However, the rest of the IDE doesn't acknowledge that anything has changed, and thus doesn't give me the option of saving my changes.


How do I make the IDE acknowledge when changes have been made to my control's properties?



asked 40 secs ago







Component editor doesn't immediately prompt for saving new property values

Aucun commentaire:

Enregistrer un commentaire