Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browse button.

Status
Not open for further replies.

zikar

Programmer
Oct 10, 2000
31
JP
Hi,

I am trying to use a standard button in a Borland CBuilder project.
This button is supposed to start a file browsing window.
The project compiles and builds fine.

But when executing, if I push the button I get a request for a system.pas path.

What is this about ?
How can I make work ?

Thanks for any idea.

Michel
 
I assume that You use the TOPenDialog.

Set the Properties, InitialDir to the wanted start point (i.e. "C:\") as well as FileName to "*.*" or whatever is suitable and the Filter to "*.*|Any File".

Should do the trick, this is taken off the top of my head, please look in the Help to get correct syntax and such.

Totte
 
Thanks for the tip.

Yes, I am using the TOPenDialog.

I set the properties as you mentioned. And tried to run the program after, but I still get the same thing complaining about the "system.pas" (system file not found).
A dialog is asking the path to this file.

Isn't there something I should add in the project options (or settings) ? Or something like that ?

Michel
 
*.pas is the xtension of those pascal files that you and I know very little about. These file are in the builder subfolders. you may be missing a file or a compile option may need checking. i.e build with runtime dll.

although I dont know why the compiler dont catch it if the latter is the case. The environment for your builder may need tweaking to include this path.

I searched my builder directory and I can find mmsystem.pas but no system.pas

If at first you dont succeed, reinstall, I always say.

Just for grins go to the options button and disable all debugging. MMsystem is located in the source/vcl folder of the buider directory. this is were most of the pas files on my system are found. this folder is listed in the debug source path. I just follow the clues.

tomcruz.net
 
Hi,

I will try to follow your suggestion and see.

But I am already using a browsing windows from a "File Open" button provided by the IDE (in another project). So I think it should work.

The only difference is that in the present case I want to fire the file browsing dialog from a standard "ok_blabla" button.

Michel
 
Very curious. I opened a project today that I havent worked on in a while. when I compiled it I got the dialog asking for the path to system.pas. I took my suggestion and the dialog went away. Curious things will happen.

tomcruz.net
 
Hi,

I tried to take off the debug options. I can get rid of the request for system.pas, by doing so; but it still hangs up with some "access violation".

Michel
 
delete the obj's and all files generated by the compiler at compile time, recompile and wait for the big guns to enter the discussion. Ok you guys you can step in anytime. .access violation may be a separate problem.

tomcruz.net
 
Michel,

Show the code you run when you click the button. It should just be like this:

if (OpenDialog1->Execute())
{
blah_blah;
}

Have you double clicked on the component on the form and seen that it opens in the Design-mode, showing you an Open Dialog? Make sure the default filename for the object isn't "system.pas". I know those are obvious, but I can't think of any other reasons why it would do that off hand...

Chris
 
Hi

The code is :

========================================
void __fastcall myForm::Button7Click(TObject *Sender)
{
// OpenDialog->InitialDir="D:\\";
// OpenDialog->FileName="*.*";
// OpenDialog->Filter="*.*|Any File";
if (!OpenDialog->Execute()) return;
}
========================================

Even just this does not work.

>>> Have you double clicked on the component on the form
>>> and seen that it opens in the Design-mode,
>>> showing you an Open Dialog?

I am not sure what you mean by that.
If I double click on the component on the form,
I get into editing the piece of code above; I do not see any Open Dialog. Is there a problem here ?

Thanks for any idea if you have one.

Michel
 
I don't know if double clicking works on previous versions, but with my experience, I'm pretty sure versions 4 through 6 will open up a dialog when you double click on the VCL component, and show you what the OpenDialog will look like at run-time. Perhaps you have an out-of-date component. Is it TOpenDialog from the Dialogs tab in Builder?

Chris
 
In your imlementation you can get rid of the if and just run the OpenDialog->Execute() method.

========================================
void __fastcall myForm::Button7Click(TObject *Sender)
{
// OpenDialog->InitialDir="D:\\";
// OpenDialog->FileName="*.*";
// OpenDialog->Filter="*.*|Any File";
OpenDialog->Execute();
}
========================================

since you ain't doing nothing with the results anyway.
you might try fiddling eith the options.

tomcruz.net

 
I have version 5.0 of C++ Builder.

As I mentioned before I am using a standard OK button, not the one we get in the Dialogs tab.
The reason I want to keep a standard button is to have something displayed there (say : "Browse").

About the double clicking I tried again on another project using TOpenDialog from the Dialogs tab in Builder, I get in the edition of the following code :

void __fastcall myForm::OpenDialogCanClose(TObject *Sender,
bool &CanClose)
{

}
//---------------------------------------------------------------------------

I never get any OpenDialog Box.

If I do the same with my standard button I get :

void __fastcall myForm::Button7Click(TObject *Sender)
{
}

I must be forgetting something trivial somewhere but What ?
:)

Bye.
 
Howdy,

I have a hard time trying to follow so many people's logical paths, so if I am repeating someone else forgive my ignorance.

I gather that the app compiles and runs fine, so if I were you I would leave everything I had on the form, and add a second button and dialog. Set the new button to open the new dialog and see what happens. If it works, delete your old ones and you've got it.

If not I don't know what you should do, but I think if all else fails a re-install of BCB may do the trick. If you can open the same dialogs with pre-existing projects, there has to be something on the build, or pre-build sides of the app that is causing this.

Sorry I'm not a "big gun" but maybe (hopefully) I'm not a moron as well...
onrdbandit
 
In majority of components,when you double click it send the cursor to the default event handler of the component,
when I read what Supernat03 said I got surprised, because I didn't know that (specially with a popular component like OpenDialog).





---LastCyborg---
 
Yes, there are several components that you can open an editor up on by double-clicking.

Try Menu components, Image components, or Coolbar.

Note: TOpenDialog doesn't have an editor in C++ Builder 4. It just goes straight to code. I don't know about 5. It does have an editor in 6 though(that's where I had seen it).

Sorry for the confusion!

You said you get a "request for a system.pas path". What exactly does it do? A messagebox pops up and says to locate it?

Chris
 
One other thing. Verify that you have the following files in place.

$CBuilderDir/Source/VCL/System.pas
$CBuilderDir/Source/VCL/Syssup.cpp
$CBuilderDir/Source/VCL/System.hpp

 
C:\Program Files\Borland\CBuilder5\Include\Vcl

I found only system.hpp

maybe I lost the cpp file somwhere. It might explaing the error I am getting. I am glad we got back on track.

tomcruz.net
 
You must have the personal version? Maybe you don't have the source files installed if you do have the professional version... but I don't think this should be the problem. I'm stumped!

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top