SavePictureDialog gets weird Filename property

SavePictureDialog gets weird Filename property

Post by Luke Parson » Thu, 09 Jan 2003 23:40:24



Well after fiddling around, I found that I had to do the save within the
same procedure that I executed the SaveDialog from. I don't know why this is
because the SaveDialog is a control I added to the form and hence should be
a global object rather than a local object only seen by the procedure that
calls it.


Quote:> Hi

> I am trying to save a simple bitmap image using the
> Image.Canvas.SaveToFile(SavePictureDialog.Filename) method but whenver I
do,
> the filename value is all corrupted. I've tried just using the SaveDialog
as
> well and it does the same thing.

> I have tried setting the Filename property during the design phase and
> checking the value (via a messagebox) before and after using the
SaveDialog.
> Before I use the SaveDialog the Filename property is good 'test.bmp' but
> after I use the SaveDialog it ends up as a random string of strange
> characters.

> If I do the Image.Canvas.SaveToFile(SavePictureDialog.Filename) method
> without using the dialog to set the name, the file saves to the filename
> that I chose in the design phase but gets an error (because of the strange
> characters) if I choose a filename with the SaveDialog.

> Is there something wrong with the Dialogs? Or is there something I need to
> do to initialise them? Surely it should just store the value of the file
> name and the value of the directory in the properties without needing to
do
> anything else. The only other Dialog I have tried is the ColorDialog and
it
> works fine, ie. it returns the a color value to the Color property of the
> ColorDialog control.

> Thanx
> Luke

 
 
 

SavePictureDialog gets weird Filename property

Post by Al » Fri, 10 Jan 2003 17:42:34



Quote:> Well after fiddling around, I found that I had to do the save within the
> same procedure that I executed the SaveDialog from. I don't know why this
is
> because the SaveDialog is a control I added to the form and hence should
be
> a global object rather than a local object only seen by the procedure that
> calls it.

Just make a global variable to hold your filename and all will be well.

 
 
 

1. Need urgent with filename property of TMediaPlayer!

Hi all!

I have 4 TImages on Form and at the same position with the same size 4
TAnimates. If I click on an image I want the Animate to be shown and an
AVI-file to be played. Afterwards the Animated should be made invislbe,
thus showing and the image, and a form should be opened.

That's the easy part.
I want to save the videos in the program-directory unter "Images", but I

can't assign the directory to the mediaplayers I use at runtime, only at

design mode. If I leave the property unassigned (only by code) it
doesn't
work at all. This is the code I use for every image:

        Mediaplayer4.Filename := GetCurrentDir+'\Images\sub.avi';
        Mediaplayer4.Display := Animate4;
        Animate4.visible := true;
        Mediaplayer4.wait := true;
        Mediaplayer4.Play;
        Animate4.visible := false;
....and then a form is shown.

Did I make any mistake or is this normal?

Using the following code I found out that your suggestion gets the exact

path of the video. But the player still doesn't play it, although the
property is properly set!

procedure TMenu1.Button1Click(Sender: TObject);
begin
    Mediaplayer1.Filename := ExtractFilePath(Application.ExeName) +
'Images\add.avi';
    edit1.text := Mediaplayer1.Filename;
end;

Any suggestions? Or could someone recommend me a component capable of
playing AVIs that sould work?

Please answer soon, I have to hand my application in!

regards,
Christian

2. .ATT File extension - Image?

3. Getting TBitmap FileName

4. 5.5 patch question...

5. Getting Printer properties for computing scale

6. Video Overlay Window on Indigo

7. Getting properties of a TIFF image

8. Weird: variable getting reset

9. REQ: filename.MOV to filename.GIF??

10. Pixels property, Scanline property

11. Preview Image in SavePictureDialog

12. SavePictureDialog