Recent

Author Topic: press Enter  (Read 5297 times)

hamza

  • Jr. Member
  • **
  • Posts: 52
press Enter
« on: May 11, 2015, 12:05:24 am »
hi

how can I press Enter by pascal programming (without keyboard)??

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: press Enter
« Reply #1 on: May 11, 2015, 01:49:37 am »
in a console or GUI application?

hamza

  • Jr. Member
  • **
  • Posts: 52
Re: press Enter
« Reply #2 on: May 11, 2015, 11:46:01 am »
Gui app

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: press Enter
« Reply #3 on: May 11, 2015, 12:04:46 pm »
Press Enter to do what? For TButtons you can simply call
Code: [Select]
button1.Click;

dogriz

  • Full Member
  • ***
  • Posts: 127
Re: press Enter
« Reply #4 on: May 11, 2015, 08:41:45 pm »
In Delphi:
Code: [Select]
  keybd_event(13, 0, 0, 0);
In Lazarus, I don't know.

More resources: http://www.codeproject.com/Articles/7305/Keyboard-Events-Simulation-using-keybd-event-funct
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: press Enter
« Reply #5 on: May 11, 2015, 11:47:36 pm »
In Windows it is the same. Search for XTestFakeKeyEvent in Linux.

bylaardt

  • Sr. Member
  • ****
  • Posts: 309
Re: press Enter
« Reply #6 on: May 12, 2015, 12:21:10 am »
  SendMessage(MyTargetObject.handle,WM_KEYDOWN,Vk_return,0)

use keydown and keyup to simulate keypress

  SendMessage(MyTargetObject.handle,WM_KEYDOWN,Vk_return,0);
  SendMessage(MyTargetObject.handle,WM_KEYUP,Vk_return,0);   

in linux you need this units:
LCLIntf, Messages, LCLType

« Last Edit: May 12, 2015, 12:25:36 am by bylaardt »

 

TinyPortal © 2005-2018