[Lazarus] Not restored Screen.ActiveForm after InputQuery

Alexey Tor. aaa5500 at ya.ru
Wed May 27 18:01:17 CEST 2020


CudaText for Linux gtk2 x64.
its Python API fails when it reads current form, after plugin shows 
InputQuery dialog.
I added test ShowMessage near the showing InputQuery and found that 
after InputQ call, program reads empty Screen.ActiveForm.
marked by comment.
is it LCL bug?
LCL must restore ActiveForm after InputQuery.
IDE r63175.

function Py_dlg_input(Self, Args : PPyObject): PPyObject; cdecl;
var
   P1, P2: PChar;
   StrCaption, StrVal: string;
   t: string;
begin
   with AppPython.Engine do
     if Bool(PyArg_ParseTuple(Args, 'ss:dlg_input', @P1, @P2)) then
     begin
       StrCaption:= string(P1);
       StrVal:= string(P2);

       t:= screen.ActiveForm.caption;////this works

       if InputQuery(msgTitle, StrCaption, StrVal) then
         Result:= PyString_FromString(PChar(StrVal))
       else
         Result:= ReturnNone;

       t+= ', '+screen.ActiveForm.caption; //this crashes
       showmessage(t);
     end
   else
     Result:= ReturnNone;
end;

Alexey Torgashin



More information about the lazarus mailing list