BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get TImage picture path?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
murn
Guest





PostPosted: Tue Nov 04, 2003 2:38 pm    Post subject: How to get TImage picture path? Reply with quote



Is there a way to get TImage picture path in Delphi 7 ?

Regards Milos


Back to top
Kurt Barthelmess
Guest





PostPosted: Tue Nov 04, 2003 4:21 pm    Post subject: Re: How to get TImage picture path? Reply with quote



"murn" <miloo (AT) email (DOT) si> wrote:

Quote:
Is there a way to get TImage picture path in Delphi 7 ?

Not once it has been loaded. The name of the file from which the image
came is not saved.

Good luck.

Kurt


Back to top
Rob Kennedy
Guest





PostPosted: Tue Nov 04, 2003 4:23 pm    Post subject: Re: How to get TImage picture path? Reply with quote



murn wrote:
Quote:
Is there a way to get TImage picture path in Delphi 7 ?

What are you talking about?

--
Rob


Back to top
murn
Guest





PostPosted: Wed Nov 05, 2003 8:19 am    Post subject: Where is Image loaded? Reply with quote

Where is statement 'LoadFromFile' ? Or where should I catch path of my
picture in (TPicture component)?

Regards Milos


Back to top
Ignacio Vazquez
Guest





PostPosted: Wed Nov 05, 2003 8:20 am    Post subject: Re: Where is Image loaded? Reply with quote

Hello, murn!
You wrote on Wed, 5 Nov 2003 09:19:17 +0100:
Quote:
Where is statement 'LoadFromFile' ?

There isn't one.

Quote:
Or where should I catch path of my
picture in (TPicture component)?

You can't, because it isn't loaded from a file. It's streamed from a
resource along with the rest of the form.

Cheers,
Ignacio



Back to top
Kurt Barthelmess
Guest





PostPosted: Wed Nov 05, 2003 11:01 am    Post subject: Re: Where is Image loaded? Reply with quote

"murn" <miloo (AT) email (DOT) si> wrote:

Quote:
Where is statement 'LoadFromFile' ? Or where should I catch path of my
picture in (TPicture component)?

TPicture has a LoadFromFile method which takes a file name, decides
what sort of TGraphic is needed to load that file, and then creates
that class of TGraphic and calls its LoadFromFile method.

While you could capture the file name at several points along the way
here, there seems to be no point in doing so. Internally Delphi never
does a LoadFromFile; only your code will. Since your code already
knows the name of the file, why make it difficult and force TPicture
to determine and remember what you already know?

Good luck.

Kurt


Back to top
murn
Guest





PostPosted: Wed Nov 05, 2003 1:00 pm    Post subject: Re: Where is Image loaded? Reply with quote

I'am working on a component that will enable design of Delphi standard
components(TStaticText, TDBEdit,TMemo,...) in runtime.
The user will determine font,size,position,.. of these components.
Then all user settings will be saved in ini file (more than one
layout/design).

So when I'am loading or saveing in ini file, i need some info about image
file.
(I'am using TImage on TPanel for image component)

Any work around would be nice!

Regards Milos.


Back to top
Ignacio Vazquez
Guest





PostPosted: Wed Nov 05, 2003 2:25 pm    Post subject: Re: Where is Image loaded? Reply with quote

Hello, murn!
You wrote on Wed, 5 Nov 2003 14:00:34 +0100:
Quote:
Any work around would be nice!

The only possible workaround would be to load it at runtime.

Cheers,
Ignacio



Back to top
Kurt Barthelmess
Guest





PostPosted: Wed Nov 05, 2003 3:29 pm    Post subject: Re: Where is Image loaded? Reply with quote

"murn" <miloo (AT) email (DOT) si> wrote:

Quote:
I'am working on a component that will enable design of Delphi standard
components(TStaticText, TDBEdit,TMemo,...) in runtime.
The user will determine font,size,position,.. of these components.
Then all user settings will be saved in ini file (more than one
layout/design).

So when I'am loading or saveing in ini file, i need some info about image
file.
(I'am using TImage on TPanel for image component)

Let us suppose for the moment that you were able to capture the file
name for a TPicture and save that name in your .ini file. The next
day, the user opens this .ini file, your code sees the reference to
'c:MyBitmap.bmp' and tries to do a LoadFromFile. But since yesterday,
the user cleaned up his hard drive and that file is no longer there.

Why do you think Delphi stores the content of the TImage at design
time in the .dfm file? Precisely so that the user can't shoot himself
in the foot.

Good luck.

Kurt


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.