[Lazarus] Formkeydown

Larry Dalton larrydalton71 at gmail.com
Fri Jun 12 15:08:15 CEST 2015


The following worked fine in Delphi. I can't get it to work in Lazarus.
Tips, please!


  procedure FormKeyDown(Sender: TObject; var Key: Word;

      Shift: TShiftState);

  const FunctionKeys:array[vk_f1..vk_f12] of string[3]=

('F1','F2','F3','F4','F5','F6','F7','F8','F9','F10','F11','F12');





procedure TMain_Form.FormKeyDown(Sender: TObject; var Key: Word;

  Shift: TShiftState);

  var show_string:string;

begin

str(key,show_string);

If messagedlg('Key
Pressed='+show_string,mtconfirmation,[mbok,mbabort],0)=mrabort then halt;

if Key=vk_f1 then agentbuttonclick(application);

if Key=vk_f2 then custom_form.CreateCar('Cars');

if Key=vk_f3 then custom_form.CreateDeal('Deal');

if Key=vk_f4 then f4panelclick(application);

if key=vk_f5 then custom_form.CreateAgent('Insurance Agent');

if key=vk_f6 then custom_form.CreatePreset('Presets');

if key=vk_f7 then custom_form.CreatePrinter('Print Forms');

if key=vk_f8 then begin
custom_form.F8PanelClick(application);top:=0;left:=0;vertscrollbar.Position:=0;end;

if key=vk_f9 then custom_form.F9Panelclick(application);

if key=vk_f10 then sendnamebuttonclick(application);

if key=vk_home then begin

if messagedlg('Home Key Pressed',mtconfirmation,[mbok],0)=mrok then

top:=0;left:=0;vertscrollbar.Position:=0;

horzscrollbar.Position:=0; }





end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150612/baad37c4/attachment-0002.html>


More information about the Lazarus mailing list