FAR3 build 3367: I am trying to open a file in the editor and get its EditorID for future use. I thought I would use this sequence:
Code: Select all
Flags := EF_NONMODAL or EF_IMMEDIATERETURN or EF_DELETEONLYFILEONCLOSE;
if FarApi.Editor(FileName, Title, 0, 0, -1, -1, Flags, 0, 1, CP_UTF8) = EEC_MODIFIED then
if FarApi.EditorControl(-1, ECTL_GETINFO, 0, @EditorInfo) <> 0 then
EditorID := EditorInfo.EditorID;
Unfortunately, the FarApi.EditorControl call always returns a zero (FALSE). So what is the correct way of opening an editor and getting its ID? Thanks.
This same code translated to Lua works correctly, I get different ID's every time the code is run.
Check whether "or" is a bitwise operator in your version of Pascal (it's not so for all Pascal implementations).
pepak wrote:On an unrelated note: If I open an editor in this way and intercept EE_CLOSE in ProcessEditorEventW, can I either:
a) Stop the close and keep the file in the editor, or
b) Override the EF_DELETEONLYFILEONCLOSE so that the file doesn't get deleted?
As far as I know: NO to both questions.