Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
how to set hotkey for button ?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Lazarus for Windows on aa...
by
Wallaby
[April 23, 2024, 11:46:56 pm]
Parameter passing odditie...
by
KodeZwerg
[April 23, 2024, 11:04:39 pm]
Can function be used for ...
by
jamie
[April 23, 2024, 10:53:10 pm]
(Solved) TIndexedAVLTree ...
by
lainz
[April 23, 2024, 10:49:03 pm]
Demo Scene Picture sinwav...
by
KodeZwerg
[April 23, 2024, 10:26:21 pm]
fkInternalCalc
by
zraja
[April 23, 2024, 09:31:07 pm]
A fairly simple sound sol...
by
KodeZwerg
[April 23, 2024, 09:23:37 pm]
add new targets to make
by
marcov
[April 23, 2024, 08:38:42 pm]
how to tweek fpmake to co...
by
marcov
[April 23, 2024, 08:29:16 pm]
Quirky windows
by
ASerge
[April 23, 2024, 07:07:16 pm]
[Request] Demo Scene Sub ...
by
Gigatron
[April 23, 2024, 06:29:39 pm]
Unlocking Files
by
KodeZwerg
[April 23, 2024, 06:03:08 pm]
[SOLVED] trunk bug for mi...
by
Key-Real
[April 23, 2024, 05:56:32 pm]
Demo Scene Bitmap Font Sc...
by
Gigatron
[April 23, 2024, 05:56:27 pm]
Compile/Convert Delphi pr...
by
Martin_fr
[April 23, 2024, 05:43:11 pm]
Generics - correct syntax
by
Thaddy
[April 23, 2024, 05:40:59 pm]
InstallAware Using Lazaru...
by
msintle
[April 23, 2024, 05:26:36 pm]
Xcode Command Line Tools ...
by
Joseph
[April 23, 2024, 05:16:39 pm]
Offical launch of the 1 B...
by
Hartmut
[April 23, 2024, 04:49:29 pm]
what to do if my target M...
by
nickysn
[April 23, 2024, 04:16:02 pm]
compiler error in unit
by
paule32
[April 23, 2024, 03:49:50 pm]
Multithreading - synchron...
by
mika
[April 23, 2024, 01:48:51 pm]
May be useful to somebody
by
KodeZwerg
[April 23, 2024, 12:38:22 pm]
match automatic highlight...
by
Чебурашка
[April 23, 2024, 11:35:14 am]
Tchart with dual numbers ...
by
wp
[April 23, 2024, 10:48:18 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: how to set hotkey for button ? (Read 10653 times)
m4u_hoahoctro
Full Member
Posts: 160
how to set hotkey for button ?
«
on:
February 13, 2013, 07:50:32 am »
how to use hotkey for a button ? give me an example code
thanks
Logged
exdatis
Hero Member
Posts: 668
Re: how to set hotkey for button ?
«
Reply #1 on:
February 13, 2013, 09:27:54 am »
In Object inspector, set caption:
example: 'Caption' and insert '&' before char who you wont for Key(It's work with Alt+char, e.g. &Caption (Alt+C)).
Regards
p.s. Also, you can use TActionList with button, easy way to configure HotKey.
«
Last Edit: February 13, 2013, 09:31:50 am by exdatis
»
Logged
Luke Snowmaker
New Member
Posts: 11
"Who are you...?" -"Nobody..."
Re: how to set hotkey for button ?
«
Reply #2 on:
February 13, 2013, 09:40:22 am »
Generally, you can start to study the basics instead of asking for everything:
e.g.
http://delphi.about.com/od/objectpascalide/a/keyboard_events.htm
and then, much faster way:
https://www.google.sk/#hl=sk&tbo=d&sclient=psy-ab&q=delphi+adding+hotkey&oq=delphi+adding+hotkey&gs_l=hp.3...7589.9776.5.9941.10.9.0.1.1.0.309.1556.0j7j1j1.9.0...0.0...1c.1.2.hp.GDJyymlGPwc&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&bvm=bv.42261806,d.Yms&fp=64726d94beef24ff&biw=1280&bih=668
«
Last Edit: February 13, 2013, 09:41:59 am by Luke Snowmaker
»
Logged
openSUSE 12.2
Lazarus IDE 1.0.4/FPC 2.6.0
m4u_hoahoctro
Full Member
Posts: 160
Re: how to set hotkey for button ?
«
Reply #3 on:
February 13, 2013, 01:04:56 pm »
example i want when i press enter, the button 1 will be call, can you give me code of that example ? thanks
Logged
exdatis
Hero Member
Posts: 668
Re: how to set hotkey for button ?
«
Reply #4 on:
February 13, 2013, 01:14:25 pm »
Do not try to use VK_RETURN, it's event onKeyPress. Try something else, if you press enter, object in focus will be started.
Regards.
p.s. onKeyPress :
if Key = #13 then //VK_RETURN(object's related)
begin
//code
end;
Logged
SunyD
Guest
Re: how to set hotkey for button ?
«
Reply #5 on:
February 13, 2013, 02:34:20 pm »
Use Action Property. Actionlists are the best eventhandler. They handle also shortcuts. You can use only one handler for many buttons, menus ....
If you change actions caption or image property then your button or menu will renamed automically. Look further:
http://lazarus-ccr.sourceforge.net/docs/lcl/actnlist/tactionlist.html
http://lazarus-ccr.sourceforge.net/docs/lcl/actnlist/taction.html
Logged
taazz
Hero Member
Posts: 5368
Re: how to set hotkey for button ?
«
Reply #6 on:
February 13, 2013, 04:54:07 pm »
To use enter as a a shortcut set the buttons default property to true and use escape set buttons cancel property to true. Only one button can be the default on a single form the same applies to cancel.
Logged
Good judgement is the result of experience … Experience is the result of bad judgement.
OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
how to set hotkey for button ?
TinyPortal
© 2005-2018