|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
file open dialog creation
Hi,
how can i create the following GUI component using Delphi: i have a set of maps and a group of data files corresponding to the maps present in a folder. now i have to create a GUI which contains two icons/images connected by an arrow mark. by clicking on the first image/icon, a file open dialog box should appear. this dialog box lists the map files that i have . once one of the maps is selected, it should be displayed on the form adjacent to the icons. by clicking the second icon/image, the same procedure as above is repeated but with data files(which are simple notepad files) i am not sure if the TOpenDialog box can be used. i may be wrong. i am a newbie to delphi and hence finding it difficult to proceed.can u help me to proceed? thanks in advance. |
|
#2
|
||||
|
||||
|
Go to the Dialogs tab and drop a TOpenDialog component on the form. Then, set the following properties for the component:
1. Set the DefaultExt property to *.map (or whatever extension you have for the MAP files). 2. Click on Filter and in the dialog box, set the properties like this: Code:
Filter Name Filter -------------------------- Map Files *.map All Files *.* 3. You can also set the Options and OptionsEx properties if you like, but the defaults ought to be ok. Now on your Icon component (is it a TImage?), create an OnClick event and put the following: Code:
procedure TForm1.Image1Click(Sender: TObject); begin if OpenDialog1.Execute then begin // Do something with OpenDialog1.FileName end; end; The Execute method calls the dialog and returns True, if the user selects a file. Then, OpenDialog1.FileName contains the name of the file that was selected by the user. Now you can do the same thing for the Data Files as well, using another TOpenDialog component.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month Looking for a perl job with kick-*** programmers in a well-known NASDAQ listed tech company with branches in the US and Europe? We're hiring. PM me for details. Requirements |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > file open dialog creation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|