Solved

Change filename in TSaveDialog

Posted on 2000-02-28
14
500 Views
Last Modified: 2010-04-04
Hi

How do I change the visible filename in a savedialog, the reason to do this is that if you have two filters and select a new one should the filename change its extension to the selected filter (like MS Office).
This also happends when the user click ok but not visible to the user.
0
Comment
Question by:koger
  • 4
  • 2
  • 2
  • +6
14 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 2565038
Hi,

Look at OnSelectionChange.

Occurs when the file types displayed in the dialog are changed.

property OnSelectionChange: TNotifyEvent;

Description

The OnTypeChange event occurs when the user selects a new filter from the Files of Type list box at the bottom of the dialog.

Regards, Zif
0
 

Author Comment

by:koger
ID: 2565081
Ok I know this but, how to actually change the visible filename
0
 

Expert Comment

by:Freaky
ID: 2565152
Don't understand what's your problem.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 2565167
hi koger,

did you adjusted the filterproperty like
Textfiles|*.txt|Docfiles|*.doc
?

meikl
0
 

Author Comment

by:koger
ID: 2565242
Year I know how to use the filter allright :-)

Try this start the TSaveDialog enter a filename change the filter then the filename will have a the selected extension in MS Office, then try the same think in Delphi the filename doesn't change.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2565268
I would have thought this wasn't a problem.  If you just type a filename, it doesn't show the extension anyway.  If you type the extension yourself, then it's your own fault for being daft!  The only way to get the dialog to perform in this way is to create your own.  

John.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2565274
? well, then i would do what zif already suggested, use the event OnTypeChange to append the new suffix, if filename is not empty
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2565298
That will work.
0
 

Author Comment

by:koger
ID: 2565337
AFAIK the tsavedialog.filename gets updated fine. I just wanted to make it foolproof, but no can do or so it seeems.
0
 
LVL 3

Expert Comment

by:sburck
ID: 2565517
Unfortunately, from the Help file:

"Programmatic changes to FileName have no effect while the dialog is active."

To do this while the dialog box is active (a live change, like in office), you'll have to modify the dialog source itself, or use a third party dialog box.
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2565830
Or you could write your own using the components on the Win 3.1 component palette

The Neil
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 2570227
Could you use another OpenDialog (an ActiveX)? There was also the possibility of an window hook of the dialog...
0
 

Accepted Solution

by:
cAkk earned 50 total points
ID: 2578603
First:
you can get dialog's handle at savedialog.OnShow
using savedialog.handle.

then:

 hParent:=getparent(savedialog.handle);
  hEdit:= FindWindowEx(hParent, 0, 'Edit',nil);

now, hEdit is the Editbox's handle.

you can set it's text by using the handle.
0
 

Author Comment

by:koger
ID: 2633976
And for all you others you can change the text with

SendMessage(hEdit,WM_SETTEXT,0,integer(PChar('text')));
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi cmd execution 6 67
Delphi...Split view - idea? 1 89
RESTRequest Parameter 4 43
Microsoft Access 97 and Delphi XE2 9 55
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

829 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