Solved

Short Keys

Posted on 2002-07-16
6
196 Views
Last Modified: 2010-04-04
In My apllication i would like to invoke the mouse click events from the keyboard through different short keys
ie to assign different onclick events of controls to keyboard also with shifting the focus to it
whats the best way of doing this
with regards
tct
0
Comment
Question by:palabros
  • 4
  • 2
6 Comments
 
LVL 17

Expert Comment

by:geobul
Comment Utility
Hi,
Drop a TActionList component on your form, double-click on it to open the actions editor, add few actions, assign ShortCuts (ShortCut property) to them and write appropriate OnExecute events.

Regards, Geo
0
 
LVL 17

Expert Comment

by:geobul
Comment Utility
Example:

type
  TForm1 = class(TForm)
    ActionList1: TActionList;
    Action1: TAction;
    Edit1: TEdit;
    Memo1: TMemo;
    Button1: TButton;
    procedure Action1Execute(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Action1Execute(Sender: TObject);
begin
  Button1.SetFocus;
  Button1Click(Sender);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('Button1 was pressed');
end;
0
 

Author Comment

by:palabros
Comment Utility
i think my question is not clear.
i have an apllication in which there some buttons ,doubleclick events on grid etc . i would like to invoke these events on keyboard shortkeys like shift+v or something of that sort
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 17

Accepted Solution

by:
geobul earned 100 total points
Comment Utility
That's what I'm talking about. In my example above there are some controls on a form and Button1 is one of them. It has its own OnClick event named Button1Click. Action1 from ActionList1 has ShortCut property set to Ctrl-V and OnExecute event which changes the focus to Button1 and fires its OnClick event. It doesn't matter where the focus currently is. It can be on a memo or edit control.

Shift-V is an alphanumeric key (capital v for example) and therefore can't be used as a shortkey.

Regards, Geo
0
 

Author Comment

by:palabros
Comment Utility
Thanks a lot. it worked fine
0
 
LVL 17

Expert Comment

by:geobul
Comment Utility
You're welcome. I'm glad that it helped you :-)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now