Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Koja je greska u kodu?

[es] :: Pascal / Delphi / Kylix :: Koja je greska u kodu?

[ Pregleda: 3395 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Napushenko

Član broj: 122151
Poruke: 172
62.162.51.*



Profil

icon Koja je greska u kodu?10.02.2007. u 14:30 - pre 209 meseci
Skino sam sa neta ovaj code i kad sam probo da ga kompilujem javlja mi neku gresku,a sta je greska ne znam.Sumnjam da je u kodu...
Code:
Program Demo1;

uses WinTypes, WinProcs, OWindows; 
{Tells the compiler which libraries are needed}

type
  PTheWindow = ^TTheWindow;  
{creates a pointer ready for the main window}
  TTheWindow = object(TWindow) 
{assigns the pointer to the window}
    procedure Paint(PaintDC: HDC;  
var PaintInfo: TPaintStruct); virtual;
end;

{ The procedure Paint is included because }
{Windows frequently hides one}
{ window behind another. Paint recreates }
{what has been covered over}

TTheApplication = object(TApplication)
  procedure InitMainWindow; virtual;
end;

procedure TTheWindow.Paint;
begin
  {later, we'll draw certain graphics }
{by adding to this procedure}
end;

procedure TTheApplication.InitMainWindow;
begin
  MainWindow := New(PTheWindow, Init(nil, 'A Program')); 
{Create the window}
end;

var
  TheApp: TTheApplication;

begin
  TheApp.Init('A Program');
  TheApp.Run;
  TheApp.Done;
end.

Run the program and it will display a blank window. 
Click the control window in the top
right hand corner of the window (for Windows 3.0 and 3.1) 
and select close.

What happened? Our graphics program created a window 
OBJECT. The object was
based on ObjectWindows through the line:

  TTheWindow = object(TWindow)

This works because ObjectWindows acts as the parent 
and TTheWindow is the child,
inheriting the behaviour of the TWindow parent. So, when 
we tell TTheWindow to do
something, like Paint:

procedure TTheWindow.Paint;

TTheWindow calls the parent, TWindow, and waits until 
the parent has sorted everything
out before the child, TTheWindow, will do anything else.

TTheWindow is descended from TWindow - it cannot
function without TWindow being
able to sort out the things that TWindow is good at 
sorting out. (Namely, creating and
controlling the window and user input/output.) At 
the moment, TTheWindow has learnt
nothing about doing anything for itself - that will 
come with later versions of the program.

Exactly the same happens with TApplication and 
TheApp. In this case, the child (TheApp)
asks the parent to initialise the application 
(TheApp.Init('A Program')), and Run the new
application. Finally, TheApp simply tells the 
parent that the job is Done.

Prikačeni fajlovi
 
Odgovor na temu

Bojan Kopanja
Bojan Kopanja
Senior Web Developer, ZeusSoftware
Stara Pazova

Član broj: 6155
Poruke: 507
*.dialup.neobee.net.

ICQ: 346697685
Sajt: www.zeussoftware.rs


Profil

icon Re: Koja je greska u kodu?10.02.2007. u 16:44 - pre 209 meseci
Ako si ovo sve kopirao onda ti je greska sve iza linije end.
 
Odgovor na temu

viking13
Aleksandar Milanovic
SBB
Novi Beograd

Član broj: 131741
Poruke: 190
*.dynamic.sbb.co.yu.



Profil

icon Re: Koja je greska u kodu?11.02.2007. u 00:00 - pre 209 meseci
Prikazao si screenshot sa totalno drugačijim kodom od ovoga o kome pišeš ovde.

Totalno nebitne stvari si ostavio vidljive, a najbitniju stvar: Compiler Messages si sasekao.

Interesantno...
viking ®
 
Odgovor na temu

viking13
Aleksandar Milanovic
SBB
Novi Beograd

Član broj: 131741
Poruke: 190
*.dynamic.sbb.co.yu.



Profil

icon Re: Koja je greska u kodu?11.02.2007. u 00:02 - pre 209 meseci
Citat:
Strog: Ako si ovo sve kopirao onda ti je greska sve iza linije end. :D


Svaki normalan kompajler ignoriše sve iza poslednje validne linije u ovom slučaju end.

viking ®
 
Odgovor na temu

Bojan Kopanja
Bojan Kopanja
Senior Web Developer, ZeusSoftware
Stara Pazova

Član broj: 6155
Poruke: 507
80.93.240.*

ICQ: 346697685
Sajt: www.zeussoftware.rs


Profil

icon Re: Koja je greska u kodu?11.02.2007. u 00:05 - pre 209 meseci
Citat:
viking13: Svaki normalan kompajler ignoriše sve iza poslednje validne linije u ovom slučaju end.


Vidis, nisam to ni probavao nikad u zivotu :D...

Evo sad sam probao i dobio sam owarning:

[Warning] Unit1.pas(25): Text after final 'END.' - ignored by compiler

Znaci to definitivno nije greska ;).
 
Odgovor na temu

[es] :: Pascal / Delphi / Kylix :: Koja je greska u kodu?

[ Pregleda: 3395 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.