Thread: some completely newbies questions

  1. #1
    Registered User
    Join Date
    Jan 2002

    Talking some completely newbies questions

    I will use this thread for all my newbies questions, I don't want to put too many threads up and jam the page, so please drop a line or two to answer my simple questions.

    here goes,

    void __fastcall TForm1::ButtonM(TObject *Sender)
    //when I double click a button, it automatically comes up!
    a function like anyother functions I define myself?

    what is the type in the Edit->Text field suppose to be?

    what is AnsiString? do I have to include any .h files to use it?

  2. #2
    Registered User
    Join Date
    Jan 2002
    Here is another one,

    I was do something like this:
    OutputScreen->Text = function1;

    where the function returns an Ansistring:
    AnsiString function ()
    return something[1];

    and something is defined:
    AnsiString something[] = {"happy", "birthday"};

    got this error!
    [C++ Error] Unit1.cpp(63): E2034 Cannot convert 'AnsiString (*)(AnsiString)' to 'AnsiString'.

    What does this mean? and how do I fix it?

  3. #3
    Your first question answer is:
    void __fastcall TForm1::ButtonM(TObject *Sender)
    //when I double click a button, it automatically comes up!

    This is a regular function as any other you would make. The function would look like this in declaration:

    void ButtonM(TObject *Sender);

    The __fastcall is a compiler keyword that cuases the compiler to perform some duty on the function I beleive. (Specific to the compiler your using, like VC++) In any case it's something you can ignore.

    The TForm1:: is the name of the CLASS that the function belongs to. So, ButtonM() fxn is a member fxn of The TForm1 Class. It would be called like so:

    TForm1 myTForm; // instance of the TForm1 Class


    ****You need to be familiar with Object Oriented Programming (OOP) which you'll learn as you progress through C++.

    Your second question answer is:

    I have no idea where you got this AnsiString object from. There is an object called string that is probably what you trying to refer to. To use the string type you must #include <string> at the top of your .CPP file. Also, plz do not use the -> symbol until you understand what pointers are. You shouldn't be using '.' (dots) or '->' symbols at all untill you understand OOP, I mean you shouldn't be using them at all.

    I would go to the library and check out a book or purchase one on C++ that is 1,000+ pages long (anything with "BIBLE" in the TITLE is a good book) and READ READ READ, at leisurely pace, until you understand the concepts of the C++ lang. Slow down is what I'm trying to tell ya becuase your getting ahead of your learning curve right now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 07:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM