Editor EE_CLOSE and RestoreScreen

A place where plug-in developers can share their knowledge and experience.
patrikp
Posts: 5
Joined: Thu 12 May, 2016 14:53
Has thanked: 1 time

Editor EE_CLOSE and RestoreScreen

Postby patrikp » Thu 12 May, 2016 15:08

Hello, currently I am developing a plugin, which opens own editor. And after closing editor (by pressing ESC), active item from panel is unset. So I would like to fix that...
In OpenW export I am saving panel screen:

Code: Select all

if (g_Plugin.Screen == INVALID_HANDLE_VALUE)
{
    g_Plugin.Screen = g_Plugin.Info.SaveScreen(0, 0, -1, -1);
}

intptr_t ret = g_Plugin.Info.Editor(
    session->TmpFile,
    session->File.c_str(),
    0, 0, -1, -1,
    EF_NONMODAL | EF_ENABLE_F6 | EF_IMMEDIATERETURN | EF_DISABLEHISTORY | EF_DELETEONCLOSE,
    1, 1,
    CP_DEFAULT);


Then after pressing ESC in editor, in my ProcessEditorEventW I am trying to restore panel state in the following way:

Code: Select all

case EE_CLOSE:

    if (g_Plugin.Screen != INVALID_HANDLE_VALUE)
    {
        g_Plugin.Info.RestoreScreen(g_Plugin.Screen);
        g_Plugin.Screen = INVALID_HANDLE_VALUE;
    }

But this has no effect at all.
Many thanks for advice.

Shmuel
Posts: 4906
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 10 times
Been thanked: 118 times

Editor EE_CLOSE and RestoreScreen

Postby Shmuel » Thu 12 May, 2016 15:30

As far as I know, plugin does not have to save and restore the screen when it opens the editor.
For example, execute the following command line:
lua:editor.Editor("fname",nil,nil,nil,nil,nil,{EF_NONMODAL=1,EF_IMMEDIATERETURN=1,EF_DISABLEHISTORY=1})
and then press Esc in the editor. There is no issue with active panel item.

patrikp
Posts: 5
Joined: Thu 12 May, 2016 14:53
Has thanked: 1 time

Editor EE_CLOSE and RestoreScreen

Postby patrikp » Fri 13 May, 2016 08:10

Thanks for reply.
Command you posted works as expected, but the issue still remains for my plugin. It doesn't work even for the following OpenW (removed ProcessEditorEventW, ProcessEditorInputW exports):

Code: Select all

HANDLE WINAPI OpenW(const struct OpenInfo * info)
{
   intptr_t ret = g_Plugin.Info.Editor(
      L"D:\\tmp\\tmp.py",
      L"D:\\tmp\\tmp.py",
      0, 0, -1, -1,
      EF_NONMODAL | EF_IMMEDIATERETURN,
      1, 1,
      CP_DEFAULT);

   return new int;
}

I tried also Viewer - same problem...

Shmuel
Posts: 4906
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 10 times
Been thanked: 118 times

Editor EE_CLOSE and RestoreScreen

Postby Shmuel » Fri 13 May, 2016 08:23

You should return NULL because you do not create a panel. That's all.

patrikp
Posts: 5
Joined: Thu 12 May, 2016 14:53
Has thanked: 1 time

Editor EE_CLOSE and RestoreScreen

Postby patrikp » Fri 13 May, 2016 08:33

Bingo :) Thanks


Return to “Plug-In Developers”

Who is online

Users browsing this forum: No registered users and 1 guest