Jump to content
Sign in to follow this  
marcocir

InputQuery texts

Recommended Posts

Hi all.

I wonder if there is a way to get a request of input in Python, showing as a VCL InputQuery box in Delphi but *without* the ugly standard title and text "Query from Python" and "Enter Text"..?
Or an alternative path to route a request of input from python to Delphi?

Any help is appreciated, thanks.

Marco

 

Clip2.jpg

Edited by marcocir

Share this post


Link to post

are you asking to  modify  the input dialog  or  are yos asking  to get data from Delphi to Python or the  opposite way ? 

Share this post


Link to post

Yes Franz, I'm asking on how to modify the generic text (title and caption of the edit) in the VCL input dialog that Dephi puts in front of my users when Pithon code executes a INPUT command.

It should be so much better to not have that completely generic dialog, to use (it's seems strange to me the actual behavior of P4D in that functionality)

Thanks

 

Share this post


Link to post
function  TPythonGUIInputOutput.ReceiveData : AnsiString;
Var
  S : string;
begin
  if Assigned( FOnReceiveData ) then
    Result := inherited ReceiveData
  else
  begin
    InputQuery( 'Query from Python', 'Enter text', S);
    Result := AnsiString(S);
  end;
end;

You can handle the OnReceiveData event and respond in whatever way you like.

Share this post


Link to post
On 5/7/2021 at 12:59 AM, pyscripter said:

function  TPythonGUIInputOutput.ReceiveData : AnsiString;
Var
  S : string;
begin
  if Assigned( FOnReceiveData ) then
    Result := inherited ReceiveData
  else
  begin
    InputQuery( 'Query from Python', 'Enter text', S);
    Result := AnsiString(S);
  end;
end;

You can handle the OnReceiveData event and respond in whatever way you like.

How would you handle non ANSI input?

 

Share this post


Link to post
1 hour ago, David Heffernan said:

How would you handle non ANSI input?

There is a corresponding event OnReceiveUniData.  Which is used is based on IO.UnicodeIO, which by default is true.

 

  • Like 1

Share this post


Link to post
On 5/7/2021 at 1:59 AM, pyscripter said:

function  TPythonGUIInputOutput.ReceiveData : AnsiString;
Var
  S : string;
begin
  if Assigned( FOnReceiveData ) then
    Result := inherited ReceiveData
  else
  begin
    InputQuery( 'Query from Python', 'Enter text', S);
    Result := AnsiString(S);
  end;
end;

You can handle the OnReceiveData event and respond in whatever way you like.

Perfect, thank you! (and also thanks for P4D, finally I'm learning another language 😉 )

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×