Daniel Ashan Posted November 4, 2010 Report Share Posted November 4, 2010 Korzystam z Lazarusa i dopiero się uczę. Chciałem napisać programik który wykonywał by pewną czynność po wciśnięciu danego klawisza. Kod programu : unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls; type { TForm1 } TForm1 = class(TForm) Shape1: TShape; procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private { private declarations } public { public declarations } end; var Form1: TForm1; implementation { TForm1 } procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState ); begin if Key = VK_UP then Shape1.left := Shape1.left + 10; end; initialization {$I unit1.lrs} end. Jednak przy próbie kompilacji w komunikatach wyskakuje takie coś : unit1.pas(33,16) Error: Identifier not found "VK_UP" unit1.pas(41) Fatal: There were 1 errors compiling module, stopping Próbowałem zmieniać VK_UP na inne wartości lecz nie pomogło. Z góry dzięki za pomoc w rozwiązaniu tego problemu Link to comment Share on other sites More sharing options...
LordLost Posted November 4, 2010 Report Share Posted November 4, 2010 Spróbuj w sekcji 'uses' dodać moduł 'Windows'. Link to comment Share on other sites More sharing options...
sazian Posted November 5, 2010 Report Share Posted November 5, 2010 z tego co mi się kojarzy to lazarus nie ma tych stałych i musisz podać odpowiednią liczbę można ją "zdobyć" na dwa sposoby 1) ShowMessage(inttostr(key)); i naciskać odpowiednie klawisze 2)tu jest spis http://delphi.about.com/od/objectpascalide/l/blvkc.htm ale wartości są podane szesnastkowo i najpierw musisz je przeliczyć na system dziesiętny Link to comment Share on other sites More sharing options...
Adam27 Posted November 5, 2010 Report Share Posted November 5, 2010 Nie ma potrzeby przeliczać liczb szesnastkowych na dziesiętne. a:=$a; //a=10 Etharnion - 2D RPG Szukam grafika chętnego do współpracy przy projekcie. Link to comment Share on other sites More sharing options...
Daniel Ashan Posted November 5, 2010 Author Report Share Posted November 5, 2010 Dzięki LordLost podziałało. Temat do zamknięcia. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.