Recent

Author Topic: Virtual keys  (Read 19858 times)

Ginithor

  • Newbie
  • Posts: 3
Virtual keys
« on: May 22, 2010, 08:25:15 pm »
I have just started using lazarus today and before that I used delphi. My question is how do you call for the use of the arrow keys. In delphi vk_down, vk_up, etc was sufficient however lazarus does not recognize it is their another name for them in lazarus?

Ginithor

  • Newbie
  • Posts: 3
Re: Virtual keys
« Reply #1 on: May 22, 2010, 08:38:54 pm »
Here is the key down procedure

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
  );
var x, y, row, col : integer;
begin
  board[mRow, mCol] := floor;
 case key of
 vk_up : begin
          if mRow > 1
          then dec(mRow);
          end;

 vk_down : begin
          if mRow < maxRow
          then inc(mRow);
          end;
 vk_left : begin
          if mCol > 1
          then dec(mCol);
          end;
 vk_right : begin
          if mCol < maxCol
          then inc(mCol);
          end;
          showboard;
 end;


unit1.pas(108,8) Error: Identifier not found "vk_up"
unit1.pas(108,8) Error: Constant Expression expected
unit1.pas(113,10) Error: Identifier not found "vk_down"
unit1.pas(113,10) Error: Constant Expression expected
unit1.pas(113,10) Error: duplicate case label
unit1.pas(117,10) Error: Identifier not found "vk_left"
unit1.pas(117,10) Error: Constant Expression expected
unit1.pas(117,10) Error: duplicate case label
unit1.pas(121,11) Error: Identifier not found "vk_right"
unit1.pas(121,11) Error: Constant Expression expected
unit1.pas(121,11) Error: duplicate case label
unit1.pas(125,20) Error: Constant and CASE types do not match
unit1.pas(125,20) Error: Constant Expression expected
unit1.pas(125,20) Error: duplicate case label
unit1.pas(125,20) Fatal: Syntax error, ":" expected but ";" found

                                     

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 8095
  • Debugger - SynEdit - and more
    • wiki
Re: Virtual keys
« Reply #2 on: May 22, 2010, 08:44:50 pm »
include the LCLType unit in your uses.

Some units are different in Lazarus, in order to better accomodate the various platforms

Ginithor

  • Newbie
  • Posts: 3
Re: Virtual keys
« Reply #3 on: May 22, 2010, 08:54:38 pm »
okay that fixed it thanks :D

 

TinyPortal © 2005-2018