how to refresh editor window by code lazarus / 9-Editor ---------------------------------------------------------------------- tintinux · 2019-10-31 10:16 Hi I'm using SourceEditorManagerIntf (Lazarus 2.0.4) and would like to know if it is possible by code to refresh the editor window, that is : reload the file in ActiveEditor, set readonly or readwrite depending of file attributes, and update IDE buttons accordingly... Thanks ---------------------------------------------------------------------- Martin_fr · 2019-10-31 10:50 refresh (is in paint): invalidate, then app.processMessages reload: that is done outside the editor, by the IDE. Maybe one of the units in IdeIntf have a function for that. Modifying the text through the SourceEditorIntf will mark the text as edited. read only: The synedit has a flag for that, that might be set-able.... But the IDE afaik has no awareness of the concept of read-only. So menu-items would not be affected. ---------------------------------------------------------------------- tintinux · 2019-10-31 11:13 Quotethe IDE afaik has no awareness of the concept of read-onlyWhen we load a .pas or .dpr file which was set read-only by the OS, it is not possible to edit the text and the save button remain disabled. This is great (it doesn't work for lfm, but that's another question). So I guess that the IDE do has some awareness of this attribute... When the read-only attribute is removed by the OS, we must currently close and reload the file, to be able to modify it. This is mainly what I would like to achieve by code. ---------------------------------------------------------------------- Martin_fr · 2019-10-31 11:31 Quote from: tintinux on October 31, 2019, 12:13:39 pmQuotethe IDE afaik has no awareness of the concept of read-onlyWhen we load a .pas or .dpr file which was set read-only by the OS, it is not possible to edit the text and the save button remain disabled. This is great (it doesn't work for lfm, but that's another question). So I guess that the IDE do has some awareness of this attribute... When the read-only attribute is removed by the OS, we must currently close and reload the file, to be able to modify it. Ok, I wasn't aware of that. I don't know where the IDE stores this info. But if there is a chance to reach it, then through other parts of the IdeIntf. I haven't much looked at the IdeIntf at all. SourceEditorIntf  is mainly access to SynEdit/SourceEditor. Which is representation of the content. The IDE stores info in "Project1", and UnitInfo. So that is a different place. There may be accessors to it. But I am not sure where. Maybe ProjectIntf?  or LazIDEIntf ? TLazIDEInterface seems to have promising methods: DoRevertEditorFile