kokoslolos 1 Posted 6 hours ago Hi, First of all, I'm not an expert in writing design time code, but this what I'm trying to achieve. I have my own custom TAction descendant, lets call it TXAction, with extra published properties (like ActionCode, ActionID, ActionName, ActionDescription ...), in design time time package that is installed in the IDE. Then I have a base form with some default TXAction components with some default properties set like ActionDescription with a place holder i.e "Export [fn] to xls" where the "[fn]" will be replaced in design time with the Form Name. In the TXAction Loaded overridden method, I have this code: procedure TXAction.Loaded; var aIXRBaseForm : IXRBaseForm; begin inherited; if (csDesigning in ComponentState) and (Owner<>nil) then begin if Supports(Owner, IXRBaseForm, aIXRBaseForm) then begin if ActionCode = ('.' + IntToStr(ActionID)) then ActionCode := aIXRBaseForm.FormCode + ActionCode; if (AnsiPos('[fn]', ActionDescription) > 0) and (aIXRBaseForm.FormName <> '') then ActionDescription := StringReplace(ActionDescription, '[fn]', aIXRBaseForm.FormName, [rfReplaceAll]); end; end; end; The code above works as expected, I have several descendant forms that inherit from this base form, and when I open them in the IDE, these inherited TXActions instead of the placeholder "[fn]" in the description, they are replaced with the Form's name. My problem is that the Save All button in the IDE is not activated for the form to indicated there was a change, like it does when a property is changed in the object inspector, so that the user can save it and store these changes in the .dfm. Although, if the Save button which is always enabled is clicked, the changes are saved! This leads me to thinking if I'm indeed doing this right, is this the correct way to change properties in design time? How can I make the Save All button enabled? Thank you. Share this post Link to post
msohn 29 Posted 6 hours ago A quick google search brought up this: https://stackoverflow.com/questions/31740385/vcl-events-handles-designer-modified So you can set Designer.Modified via the parent form - but checks for csDesigning and Designer <> nil are required. Also you should obviously set Modified only if you've actually modified something. Share this post Link to post
kokoslolos 1 Posted 6 hours ago I was planning to write this but I forgot, I use Delphi 2007. Does this solution work for this version of delphi? Share this post Link to post