Solved

Newbie Questions

Posted on 2004-10-27
196 Views
Last Modified: 2010-08-05
1-I am trying to add a new form!
how to do that, I went NEW >> FORM and I got a new one. but each time I type Form2. in Form1 this error gets in the way
Form2 is in Unit2 and form1 in unit1
is that sapposed to be like this?

Build
  [Pascal Error] Unit1.pas(1): Unable to invoke Code Completion due to errors in source code

2- In VB there is ListBox which is MemoBox in Delphi
There is also ListView, what is it in delphi? and how to use it?
The difference ListView has many columns not only many rows, each column may have a title...
0
Question by:instant_new
    8 Comments
     
    LVL 2

    Expert Comment

    by:DeNavigator
    What error do you get?

    Maybe this is your solution:
    add unit2 to the uses clause in the implementation section of unit1
    then do something like:

    begin
      Form2 := TForm2.Create(self);
      try
        Form2.ShowModal;
      finally
        Form2.Free;
      end;
    end;
    0
     
    LVL 2

    Expert Comment

    by:DeNavigator
    Second part:
    ListView is also a component in Delphi on the Win32-tab. If you want columns put de view style to vsReport. You can (and must) add the columns via the columns property
    0
     
    LVL 31

    Expert Comment

    by:moorhouselondon
    If you click on the Form, press F11, you will see the Name of the form is Form1.  Try changing it to something else there.  But if you want to change the Main Form then this can be changed in Project, Options, Forms, Main Form.

    The Unit name is when you pull down and Save the pas file, and this can be called something more meaningful too (but not the same name as the form - I stick an f in front for the Form).
    0
     
    LVL 31

    Expert Comment

    by:moorhouselondon
    "But if you want to change the Main Form then this can be changed in Project, Options, Forms, Main Form."

    Let me clarify that:  ...if you want to change where the program starts running from then this can be changed....
    0
     
    LVL 17

    Expert Comment

    by:TheRealLoki
    you need to add "uses Unit2" in your unit 1 "uses" clause at the top.
    If you need to see form1 from form2, you will need to add 'uses uni1" in the "implementation section (not at the top)
    otherwise you will get a circular reference

    TListView is in the Win32 Tab of the component palette
    Drop 1 on your form, and set it's ViewStyle to vsReport
    you can now right click on the listview and add columns and items.
    0
     

    Author Comment

    by:instant_new
    the only one that worked is DeNavigator's answer but it has problems
    Im getting
    Build
      [Error] Unit1.pas(23): Undeclared identifier: 'self' //<< Form2 := TForm2.Create(self);
      [Error] Unit1.pas(29): '.' expected but ';' found //<< end;
      [Fatal Error] Project1.dpr(6): Could not compile used unit 'Unit1.pas'
    I changed self to Form2, but I still have the second problem.
    can you help?
    0
     
    LVL 2

    Accepted Solution

    by:
    You should place this code in the OnCLick Event of a button like:
    procedure TForm1.Button1Click(Sender: TObject)
    begin
      Form2 := TForm2.Create(self);
      try
        Form2.ShowModal;
      finally
        Form2.Free;
      end;
    end;

    This should clear your bugs. :)
    0
     

    Author Comment

    by:instant_new
    solved the problem
    thanks all
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    860 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now