ok i am a new programmer and am running in windows xp and 98 and am using the borland c++ builder 3, I am trying to make a window that will simply ask the user to input a string (called pathname) and store it to another file for use in another program. i can see a kinda outline like i explained, but have no idea how to implement it, can anyone help me?

p.s. can you guys also recomend the best compiler as well, i like the enviroment of borland but heard that there are better compilers, are there any that have the save enviroment but better?

That's a pretty loaded question. Qualify first how you want to do it, meaning are you going to use a resource or create the dialog directly within code. Which compiler are you using now. If it's VC++ then are you using MFC. It might be an idea to post something you've already tried or a basic idea how you think it should be done and then help from whomever can be focused

Best compiler, well in 1998 when I bought VC++ 6.0 it was $700.00 Canadian. Does it make it the best one. I doubt it very much, but it's got a lot of stuff. It's been my experience the more STUFF a program has the more likely it's not very good at the job it's supposed to do. Other than that, I've used GCC and it is every bit as comprehensive as VC++, lacking IDE though (big deal). So your question should maybe be rephrased which compiler can I get for $$$, whatever your budget.

That's a pretty loaded question. Qualify first how you want to do it, meaning are you going to use a resource or create the dialog directly within code.

i think dialog directly within code, but then again i am a newby and don't really get the question, what do you mean by a resource

Which compiler are you using now. If it's VC++ then are you using MFC. It might be an idea to post something you've already tried or a basic idea how you think it should be done and then help from whomever can be focused

as i said before, i am using borland c++ builder 3, and tried using a pre started dialog, but i don't understand it (borland has it's own application making thing where i just point and click, and the code looks like this

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Label1Click(TObject *Sender)
{

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

void __fastcall TForm1::Edit1Change(TObject *Sender)
{
    
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{

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

void __fastcall TForm1::Button2Click(TObject *Sender)
{

}

or i can make it look like this (which doesn't help me at all either)

object Form1: TForm1
  Left = 192
  Top = 116
  Width = 270
  Height = 130
  Caption = 'Form1'
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 123
    Height = 13
    Caption = 'Enter path to save files to:'
    OnClick = Label1Click
  end
  object Edit1: TEdit
    Left = 32
    Top = 24
    Width = 121
    Height = 21
    TabOrder = 0
    Text = 'C:\'
    OnChange = Edit1Change
  end
  object Button1: TButton
    Left = 64
    Top = 56
    Width = 75
    Height = 25
    Caption = 'OK'
    TabOrder = 1
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 152
    Top = 56
    Width = 75
    Height = 25
    Cancel = True
    Caption = 'Cancel'
    TabOrder = 2
    OnClick = Button2Click
  end
end

and like i said before this is my first semester programming so don't know a lot, i can make it in a dos based thing but am really hopeing to get it as window.

Sorry, I missed the Borland part. The first segment of code are the events that are either preset with those controls, or you selected something in a dialog box you initialize those events. The second part is what the resource editor uses to position them and other parametes. What you have on this dialog is

1 Label
1 Edit
2 Buttons

What you have to do is put code in those sections that suit your needs. For example in TFrom::Button1Click (TObject *Sender) is where you would read the contents of the edit control and write it to the file.

What you are dealing with here is what M$ refers to as MFC. I am not familiar with this (Borland) environment at all and you might be better off asking this question in
http://www.daniweb.com/techtalkforums/forum6.html
Geeks Lounge as your question is more related to using GUI and Borland.

Sorry I can't be of greater help

ok well i got this so far, but can't get it to work, how do i get it to see what is writen in the text field?

#include <vcl.h>
#pragma hdrstop
#include <iostream>
#include <conio>
#include <fstream>
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::OkClick(TObject *Sender)
{
char *path = new char [100];
path = ;
ofstream save;
save.open("path.dat");
save << path;
save.close();
exit(0);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CancelClick(TObject *Sender)
{
exit (0);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::pathChange(TObject *Sender)
{

}

this is:

1 label
1 edit (path)
2 buttons (ok, cancel)

(ok) saves the data in edit (unsure who to do this part)

In your ok button click event you have to read the contents of path. Not having used borland I'm not sure how its done, but using a WIN32 API it would be GetWindowText (hWnd, char *, int size); or in MFC path.m_text where m_text is the variable assigned to object path. So you don't need the variable path in your ok button click event.

So all you have to do is find out how to read the text from path edit control and then use save << ??? whatever that method is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.