freelanceprogrammers.org Forum Index » Delphi

Find created objects


View user's profile Post To page top
fabiochelly94 Posted: Thu Sep 01, 2005 6:52 pm


Joined: 01 Sep 2005

Posts: 4
Find created objects
Hi,

I use the PyDelphiWrapper component to create Forms from my Python code.
My exe Delphi doesn`t cointain any Form, just a DataModule to contain
my P4D components.
The problem is that I don`t have an Application.run loop in my application.
So, when the last line of my python code is reached, the delphi
program is closed even if Forms (created by my python code with
CreateComponent) are still open.

To solve this problem I need to loop until all forms are closed.
So is there a way to get the list of forms (created with
CreateComponent) and to test if they`re closed from my Delphi code?

Best regards,
Fabio Chelly
Reply with quote
Send private message
View user's profile Post To page top
morgan_martinet Posted: Thu Sep 01, 2005 7:09 pm


Joined: 29 Apr 2005

Posts: 103
Find created objects
Hi Fabio,

> I use the PyDelphiWrapper component to create Forms from my Python code.
> My exe Delphi doesn`t cointain any Form, just a DataModule to contain
> my P4D components.
> The problem is that I don`t have an Application.run loop in my
> application.
> So, when the last line of my python code is reached, the delphi
> program is closed even if Forms (created by my python code with
> CreateComponent) are still open.
>
> To solve this problem I need to loop until all forms are closed.
> So is there a way to get the list of forms (created with
> CreateComponent) and to test if they`re closed from my Delphi code?

Why don`t you invoke "Application.Run()" from Python, as your last script`s
statement???

Or from Delphi, once you run your script, immediately call Application.Run;

Note that both solutions will only work if your application has a main form!
It means that the first form you create must be created using the Form type
and not using the CreateComponent call:
f = Form(Application)
f.Caption = "Hello world"
f.Show()
Application.Run()

Bye,

Morgan
Reply with quote
Send private message
View user's profile Post To page top
fabiochelly94 Posted: Fri Sep 02, 2005 1:25 pm


Joined: 01 Sep 2005

Posts: 4
Find created objects
Thank you for your answer. It works fine.

I also finally found how to test if there is still a form active:
Screen.Forms returns the list of forms and I can test it in my manual
loop.
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help