Re: OpenPictureDialog Problems
- From: "Henry Bartlett" <hambar@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 24 Jul 2005 10:56:49 +1000
"Rob Kennedy" <me3@xxxxxxxxxxx> wrote
<snip a whole bunch of insightful remarks about my rather stupid
comments> 8-)
You are quite right of course. As you say, the OP needs to get into
the habit of using meaningful names for his components.
And, if he had added comments showing what each of his methods is
intended to do, it would have made it easier to help him.
Having looked more closely at the code I suggest that the OP should
set a private form variable in the onMouseDown handler
e.g. fCurrentShape:
and in the MouseDownOnShape method:
if Sender is TManyShape then
begin
fCurrentShape := tManyShape (Sender);
// safe because we have established that "Sender is TManyShape "
etc...
Then he has a known alias that he can use in Button1Click instead of
the meaningless local variable.
If Assigned (fCurrentShape) then
fCurrentShape.Image := Bitmap;
or probably better, depending on how tManyShape.Image is implemented
..If Assigned (fCurrentShape) then
fCurrentShape.Image.LoadFromFile(OpenPicDlg.FileName);
--
Henry Bartlett
Delphi Links Page:
( http://www.hotkey.net.au/~hambar/habit/delflink.htm )
.
- Follow-Ups:
- Re: OpenPictureDialog Problems
- From: cybatech
- Re: OpenPictureDialog Problems
- References:
- OpenPictureDialog Problems
- From: cybatech
- Re: OpenPictureDialog Problems
- From: Maarten Wiltink
- Re: OpenPictureDialog Problems
- From: cybatech
- Re: OpenPictureDialog Problems
- From: Henry Bartlett
- Re: OpenPictureDialog Problems
- From: Rob Kennedy
- OpenPictureDialog Problems
- Prev by Date: Re: TChart titles
- Next by Date: Re: OpenPictureDialog Problems
- Previous by thread: Re: OpenPictureDialog Problems
- Next by thread: Re: OpenPictureDialog Problems
- Index(es):