?
Solved

Error-Proof SavePictureDialog.Execute

Posted on 2003-10-27
6
Medium Priority
?
563 Views
Last Modified: 2008-01-16
Hello Experts,

I'm looking to write an fullproof OnExecute for a savepicturedialog box.  here is a model of what I'm looking for.  Solutions don't have to fallow the format exactly if someone has a better way,  That's part of the reason I'm here.  I want this to support all available image formats.

If SavePictureDialog.Execute then
begin
  // code to extract last three char of spd.filename.
  // a workable filterindex here is suitable.
  // if possible I'de like to evaluate the charstring and use
  // GetGraphicsExtention(EvaluatedType);
end;

It's late and I'm really tired so excuse me if I left something out or did something wrong in my example.  What I'm shooting for is to avoid using a long series of if statements to save diferent filetypes.  If there is a way to use a case statement and call a seperate function that's ok too.  I think case statements are cleaner (If only they supported stringtypes.)  Thanks in advance.
0
Comment
Question by:fibdev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 800 total points
ID: 9632136
?

SavePictureDialog.Filter := GraphicFilter(TGraphic);
If SavePictureDialog.Execute then
begin
  // code to extract last three char of spd.filename.
  ext := ExtractFileExt(savepocturedialog.filename);
  // a workable filterindex here is suitable.
  ?? see above firstline
  // if possible I'de like to evaluate the charstring and use
  // GetGraphicsExtention(EvaluatedType);
  Ext2 := GraphicExtension(YourGraphicClass);  //for ex TBitmap

end;

not sure for what you after

meikl ;-)

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9632145
>If there is a way to use a case statement and call a seperate
>function that's ok too.  

you could use a static tstringlist like

case myStaticStringList.IndexOf(MyExt) of
  1 : ...
0
 
LVL 3

Author Comment

by:fibdev
ID: 9638409
Looking good so far.

A note about this statement...

  // if possible I'de like to evaluate the charstring and use
  // GetGraphicsExtention(EvaluatedType);

I know it's probably something I'm doing incorrectly, but I've had bugs by using filter and filterindex.  I like the idea of the string list to make absolutely sure the filetype is correct.

procedure DoSave();
 var iExt : String;
begin
  case myStaticStringList.IndexOf(MyExt) of
    1 : iExt := GetGraphicExtension(TBitmap);
    2 : iExt := GetGraphicExtension(TGifImage);
    3 : ...
  end;
end;

I like this, but there has to be a way to achive this with less code.  If we can come up with a solid save procedure for all image formats then I will give points to all serious contributers and maybe, we can come up with something really good that ppl can use.  Thanks   :)

Gabe
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:fibdev
ID: 9810575
TIssue.StillUnresolved('Please Post More Fallow-up Comments');
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9810656
run out of ideas :-(
0
 
LVL 3

Author Comment

by:fibdev
ID: 10090598
Thanks for trying kretzschmar,

I'm just cleaning up old questions.....
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month11 days, 6 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question