Shortcut Keys of Delphi

If you never used the shortcut keys of Delphi, you would not be aware that it is a wonderful thing. But as soon as you begin, you will never give it up. My suggestion on it is that using shortcut keys when you begin to program with Delphi. It will give you a lot of help.

The following is some of the Delphi shortcut keys(if you have not changed them yet) which I think is very usually used. You can get more from the Delphi help file. If you think some others are important too, you can tell me by the email.

Shorcut KeyFunctionSupplement
ctrl + spaceGet the name of methods or variants, if after an Object, you will get the list of Object's property and methods.If the input method has used this shortcut key, you should change it to make it can be used in delphi.
ctrl + shift + cComplete the class at cursorIf you add some methods to a class, what you need to do is just writting the declaration in the interface part of the class and use this shorcut key to get the body part.
ctrl + shift + up arrowGo to the declare part of the method whose body part is at cursor. 
ctrl + shift + down arrowGo to the body part of the mothod whose declare part is at cursor. 
ctrl + o + cChange the select way to verticalAfter you press this shortcut key, and you can select the code vertically.(Only help you select vertically using key(shift + arrow).)
ctrl + o + kChange back to normal state form the above one. 
F12Toggle between the code screen and the form one. 
ctrl + F12View units(You will get a units list after pressing this shortcut key. )If you install the PowerWord, this shortcut key will be occured by this software, you can change it to make it can be used in Delphi
shift + F12 View FormsYou will get a forms list after pressing.
alt + F12Use unitYou will get a units list from which you can select the unit you want to use(add the unit name to the use part of implemetation).
F9RunIf you are debug, it will run to the end of this funcition.
ctrl + F9Compile 
ctrl + F2Program resetStop the run state.
F5Add(Delete) break point on the line at the cursor 
F8When you debug, step one line code. 
F7When you debug, step into the method on the line. 
F4When you debug, run to the line at the cursor. 
ctrl + F5Inspect the value of the variant at the cursor. 
alt + F5Add to watch at the cursor 
ctrl + jGet the template of some useful code structure.For example for,try etc. You can add what you like by the following Tools/Editor Options/Code Insight
ctrl + fOpen the searching dialog and the word at the curor has been the content of searching(Of course you can change it ). 
F3 Find next one. 
alt + F11Open project 
ctrl+clickWhen you write code, you can use this way to go to the declaration of the method at the cursor, when you debug, you can get the property or value of the variant at the cursor. 
F11Show the Object Spector or the form window if they are not visible. 

版权所有:idilent 网站转载请注明作者 其他转载方式请与作者联系(idilent@yahoo.com.cn)。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
TApplication.OnIdle   当应用程序变为空闲时,OnIdle事件发生。   使用OnIdle事件,可以写一个应用程序空闲时执行特定处理的事件处理程序。当应用程序不处理代码时,称为应用程序空闲。例如,当应用程序等待来自用户的输入时,应用程序为空闲。   TIdleEvent类型是OnIdle事件的类型,它指向一个应用程序空闲时运行的方法。TIdleEvent类型有一个布尔型参数Done,默认时该参数为True。若参数Done为True,当OnIdle事件返回时,调用Windows API WaitMessage函数。只有在应用程序消息队列中出现一个新消息时,WaitMessage函数才放弃对其他应用程序的控制。参数Done为False时,即使应用程序不忙,也不放弃对其他应用程序的控制。   当应用程序转移到空闲状态时,只调用一次OnIdle事件。除非参数Done设置为False,否则不连续调用OnIdle事件。将参数Done设置为False的应用程序,将消耗过多的CPU时间,从而影响整个系统性能。 在delphi中, 当在一个窗口上放置一个ApplicationEvents控件时,Application将会把所有的事件都转寄到ApplicationEvents; 也就是说,ApplicationEvents可以拦截到应用程序的全部事件,包括OnActivate\OnHelp\OnIdle\OnRestore\OnShortCut等等, 甚至可能通过OnMessage事件,在其中截取所有post到应用程序中所有窗口的消息,如WM_PAINT,WM_KEYDOWN, WM_KEYUP等常见的windows消息; 所以当有消息到来的时候就会触发它的OnMessage事件,在OnMessage中监视消息就可以了。 Action的事件有OnExecute和OnUpdate,OnExecute事件在控制被触发时响应,比如说按钮被按下,菜单被按下,而OnUpdate事件是在应用程序空闲时被调用, APPLICATIONEVENTS是用来捕获程序级事件的 ApplicationEvents1Message(var Msg: tagMSG;var Handled: Boolean); {通过 Perform 向窗体发送 消息; OnMessage 收不到} {通过 SendMessage 向窗体发送 消息; OnMessage 收不到} {通过 PostMessage 向窗体发送  消息; OnMessage 可以收到}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值