Article View: borland.public.cppbuilder.nativeapi
Article #3217Re: List Files
From: Thorsten Kettner
Date: Tue, 01 Aug 2006 06:56
Date: Tue, 01 Aug 2006 06:56
37 lines
2451 bytes
2451 bytes
"Renan" <gulbrrs@gmail.com> wrote: > Edit1->Text = ExtractFileName(OpenDialog1->FileName); > Edit2->Text = ExtractFileName(OpenDialog1->FileName); > >With this code, even if I select 2 diferent files, Edit1 and >Edit2 gets the same filename. What can I do to select 2 files? Of course. Why should OpenDialog1->FileName suddenly contain another value than before? Use FileName only if the dialog is for picking one single file. > > Edit1->Text = ExtractFileName(OpenDialog1->Files); > Edit2->Text = ExtractFileName(OpenDialog1->Files); >With this code, I get an error msg: > >[C++ Error] Unit1.cpp(32): E2034 Cannot convert 'TStrings * >const' to 'AnsiString' Yes. OpenDialog1->Files is a string list whereas ExtractFileName expects a string. Use TStrings::Strings to access the single strings contained in the string list: Edit1->Text = ExtractFileName(OpenDialog1->Files->Strings[0]); Edit2->Text = ExtractFileName(OpenDialog1->Files->Strings[1]); This said, I wonder what the edit boxes are for, anyhow. You said the renaming would be done by an algorithm. So why not do the conversion silently by code? Why put the file names into edit boxes? Even if the renaming would not be done automatically, but by user input, I would not recommend TEdit. Who knows how many files the user will select. You would have to create a lot of edit boxes - one per file. If you need a series of edit boxes, use TStringGrid instead.
Technical Details
Message-ID:
<44cefb13$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<44c97103$1@newsgroups.borland.com> <44c9b8d0$1@newsgroups.borland.com> <44ce0ad7$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,fe8a549e850bf32c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Thorsten Kettner" <ANSWERBYthorsten.kettner@otto.de> Sender: "Thorsten Kettner" <ANSWERBYthorsten.kettner@otto.de> Reply-To: "Thorsten Kettner" <ANSWERBYthorsten.kettner@otto.de> Subject: Re: List Files Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 80.85.196.94 References: <44c97103$1@newsgroups.borland.com> <44c9b8d0$1@newsgroups.borland.com> <44ce0ad7$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <44cefb13$1@newsgroups.borland.com> Date: 31 Jul 2006 23:56:19 -0700 X-Trace: newsgroups.borland.com 1154415379 207.105.83.66 (31 Jul 2006 23:56:19 -0700) Lines: 37 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail