Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to turn menu accelerators on and off Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
23-Oct-02
Category
VCL-Menu
Language
Delphi 2.x
Views
54
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How can I turn off menu accelerators? It's not done with MenuItem.enabled:=false. I 
need that because I have set the accelerators 'Delete' and 'Insert' to menu items, 
but in some situations those keys need to be "free" for other purposes (when the 
user is editing an EditBox, in my case).

Answer:

Your message implies, but doesn't state, that you are using standard windows 
shortcuts for Delete (Del key) and Insert (Ins key) features. You want to use them 
as the standard when the active control is an edit box but not under other 
circumstances.

I had a similar situation and resolved the problem using a TActionList. Use the 
OnExecute event to determine if you are using your own or windows processing. 
Unfortunately, the windows processing doesn't occur automatically and you have to 
handle the action yourself. Here's my solution for Delete:
1   
2   procedure TfrmBuildQuery.alExpressionExecute(Action: TBasicAction; var Handled:
3     Boolean);
4   begin
5     if Action = aDelete then
6       if eValue.Focused then
7         {This is the edit control I needed to have windows-like changes}
8       begin
9         Handled := True; {Stops it from going to the delete action}
10        with eValue do
11        begin
12          {If no selection, then select the char to the right of the cursor.}
13          if SelLength = 0 then
14            SelLength := 1;
15          {Do the delete}
16          SelText := '';
17        end;
18      end
19      else
20        Handled := False
21    else
22      Handled := False;
23  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC