3

I don't have the Delphi IDE installed. Can I still design forms?

Robert Love
  • 12,447
  • 2
  • 48
  • 80
user198729
  • 61,774
  • 108
  • 250
  • 348
  • Mention WinForms are you using .NET? If So this should be tagged Delphi-Prism – Robert Love Dec 31 '09 at 15:32
  • No,I don't have .NET installed. – user198729 Dec 31 '09 at 15:45
  • It would be helpful to know what version of Delphi you're using. Delphi 2007, 2009, and 2010, for instance, use MSBuild and have a batch file that sets up all of the environment variables. Also, Delphi doesn't do WinForms since D8/D2005. – Ken White Dec 31 '09 at 15:46
  • I haven't installed delphi yet,and I'm seeking of an IDE-free solution – user198729 Dec 31 '09 at 15:49
  • So the question is not really about designing forms in the first place, but about a commandline compiler? And it is really not about .Net (WinForms) either, but just window applications (win32 VCL)? – Lars Truijens Dec 31 '09 at 15:54
  • 1
    It's two question:designing forms in delphi and commandline compiler – user198729 Dec 31 '09 at 15:57
  • 1
    Welcome to Stack Overflow. As you've just admitted, you have two questions. Please therefore *post* two questions. They really have completely different answers, so you shouldn't require everyone to have to know the answers to both just to post a single response. Since the answer you have now is about your first question, I've edited the body to match the title. Please post *another* question asking how to compile without the IDE. – Rob Kennedy Dec 31 '09 at 16:00
  • 1
    Plus, asking two questions gives you twice the opportunity for reputation points. They're both good questions, but I can't vote them both up if they're stuck together. Also, together they're *not* a very good single question. – Rob Kennedy Dec 31 '09 at 16:10

4 Answers4

5

Using Win32: File | New Unit then you have full control of the code.

var
  F : TForm;
  L : TLabel;
begin
  F := TForm.Create(Application);
  L := TLabel.Create(F);
  L.Parent := F; // Needed to have it show up on the form.
  L.Left := 50;
  L.Top := 50;
  L.Caption := 'This is an example';
  F.Show;
end;

In .NET / Delphi Prism: Right Click on the Project|New Item|Class

namespace WindowsApplication2.Properties;

interface

uses
  System.Windows.Forms,
  System.Collections.Generic,
  System.Linq,
  System.Text;

type
  Class1 = public class(System.Windows.Forms.Form)
  private
  protected
    lablel1 : Label;
  public
     constructor;
  end;

implementation

constructor Class1;
begin
  self.label1 := new System.Windows.Forms.Label();
  self.SuspendLayout();

  self.label1.AutoSize := true;
  self.label1.Location := new System.Drawing.Point(37, 80);
  self.label1.Name := 'label1';
  self.label1.Size := new System.Drawing.Size(35, 13);
  self.label1.TabIndex := 0;
  self.label1.Text := 'This is an Example';

  self.ResumeLayout(false);
  self.PerformLayout();  
end;

end.
Robert Love
  • 12,447
  • 2
  • 48
  • 80
3

Assuming from your answers that you do not have any compiler installed. In order to compile Delphi code you would need a compiler. There are no free versions available of Delphi anymore so unless you can find an old one you would have to buy Delphi. Delphi comes with a commandline compiler like gcc and can compile programs without an IDE.

Delphi 2006 and before win32:

dcc32 YourProject.dpr

Delphi 2006 and before .Net:

dccil YourProject.dpr

Delphi 2007 and after:

msbuild YourProject.dproj

This will result in a compiled binary and in case of an EXE you can run it like you are used to.

Robert Love explained perfectly how to write code to display a GUI without using the designer in the IDE. This will save you no money since you will have to buy the IDE anyway in order to get the commandline compiler.

There are free alternatives to Delphi like FreePascal and their free IDE Lazarus. I haven't checked for myself but I am pretty sure it comes with a commandline compiler as well.

Community
  • 1
  • 1
Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
  • D2007+ afaik do dcc32 fine too. I would equate msbuild more with make in older versions, not dcc32. Free Pascal has a commandline compiler "ppc" per architecture, and a frontend binary "fpc" to switch between them – Marco van de Voort Dec 31 '09 at 16:34
  • True, but D2007 and up do not use .cfg files anymore so you will miss any project options you have set and would have to supply them as parameters. – Lars Truijens Dec 31 '09 at 16:42
0

First, you don't need Delphi IDE to run a Delphi program. Delphi generates (usually) standalone .EXE applications, so

foo.exe

works as expected.

Second, you can compile your Delphi project with command line compiler. The exact syntaxis depends on your installed Delphi version. Take a look at this post or search for Delphi commandline compiler

Daniel Luyo
  • 1,326
  • 13
  • 19
0

Note that the already mentioned Lazarus also comes with a Delphi-like designer.

Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89