Board index » delphi » Newbie, A project without a form? How to

Newbie, A project without a form? How to

To anyone who has allready helped, and has not had a thankyou,... Thanks
alot, So far ALL the queries I have bounced off this group have been
successfuly answered!  A few helpdesks could learn from this.

Having used your help, I have usualy been able to 'reverse engineer' the
problems and look for the appropriate entry in the manual, most times it
is not there, occaisionaly it is obscurely referenced!

My latest obstacle is a bit obscure.

One of the exercises in the D1 Manual asks for a unit (no problem so
far) and a similar 'script/source code' text.

The unit is called vclass.pas and is headed       unit vclass;

The other code is called     program virtual;     and is saved as
virtual.dpr,               it USES vclass

SO FAR this looks just like a normal pascal program that calls
procedures or functions from a unit

The problem is that the when trying to compile the unit Vclass, the
error message follows

Error in module vclass: Declaration of class Tform1 is missing or
incorrect.

the code I have written looks JUST like the book and they don't mention
any forms, neither does virtual.dpr

Do Delphi programs ALLWAYS have forms, I have inserted the offending
unit here...
[ Section: 1/1 File: vclass.pas Encoder: Turnpike Version 3.00 ]

begin 644 vclass.pas
<uuencoded_portion_removed>
H+E-E8V]N9"<I.PT*14Y$.PT*#0H-"GLD4B`J+D1&37T-"D5.1"X-"@``
`
end

sum -r/size 45417/2193 section (from "begin" to "end")
sum -r/size 12899/1570 entire input file

Sorry to be such a bore but I am finding my confidence in the Delphi
book not living up to the product. You are my source of renewed faith

STOP Right There, I have had another crack and I have done two things

1. I deleted the vclass.dfm file from the directory,( it apperaed to be
responsible for telling Delphi there was a form expected)

2. I removed the ';' from a few of the class declaration lines and
vclass.pas now compiles.

I am still having trouble creating a '*program*' file to USE vclass;  

I will post this if I don't find an answer before the end of play
tonight, I'm really flying on instruments here!

Cheers,  Jim

Jim Barr        Machine Conversation
                http://www.wandana.demon.co.uk/
                Best is the enemy of good enough

                Leaves rustle,   blades turn,    water moves

 

Re:Newbie, A project without a form? How to


In article <ZVkXYEA5CB1yE...@wandana.demon.co.uk>,
   Jim Barr <JimB...@wandana.demon.co.uk> wrote:
]-One of the exercises in the D1 Manual asks for a unit (no problem so
]-far) and a similar 'script/source code' text.
]-
]-The unit is called vclass.pas and is headed       unit vclass;
]-
]-The other code is called     program virtual;     and is saved as
]-virtual.dpr,               it USES vclass
]-
]-SO FAR this looks just like a normal pascal program that calls
]-procedures or functions from a unit
]-
]-The problem is that the when trying to compile the unit Vclass, the
]-error message follows
]-
]-Error in module vclass: Declaration of class Tform1 is missing or
]-incorrect.

Try removing the resource file directive -- {$R *.DFM} -- at the
bottom of your unit code.  Also, you have a few too many semi-colons...

  TChild1 = Class(TBaseClass);
                             ^
                 [ get rid of these guys ]
    Procedure First; Override;
  END;

once I removed these your vclass unit compiled cleanly both with
command-line compiler (DCC.exe) and in the IDE.  I also made a
dummy .dpr file

  program virtual;
  uses vclass;
  BEGIN
  END.

that too compiled just fine both ways.

Mark Vaughan

]-
]-the code I have written looks JUST like the book and they don't mention
]-any forms, neither does virtual.dpr
]-
]-Do Delphi programs ALLWAYS have forms, I have inserted the offending
]-unit here...
]-[ Section: 1/1 File: vclass.pas Encoder: Turnpike Version 3.00 ]
]-
]-begin 644 vclass.pas

[ code removed... ]

Other Threads