Arsip: Deteksi penekanan tiga tombol sekaligus
more 17 years ago
Random
Kalo mau deteksi penekanan sebuah tombol aja kan caranya biasa aja, misalkan :
if key =#13then //untuk enter
Nah, kalo misalkan mau deteksi penekanan tiga tombol gimana ya ? Misalkan Ctrl-Alt-1 (angka 1).
more 17 years ago
pebbie
simpan di variabel global sebagai array flag (keydown).. klo down flag di set klo up flag di clear..
klo ngeceknya tinggal if key[key1] and key[key2] and key[key3] dst... then
more 17 years ago
DelphiExpert
Ctrl, Alt dan Shift harus dideteksi dengan cara membaca parameter Shift: TShiftState yg disertakan dalam event method... atau bisa dibaca menggunakan native function GetKeyState
angka 1 dibaca dari parameter Key ...
contoh:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (ssCtrl in Shift) and (ssAlt in Shift) and (Key = Ord('1')) then
end;
more 17 years ago
Random
Kalo kayak gini juga bener kan ? (pas dicoba sih jalan, tapi ga tau kalo ada kekurangan)
If (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_MENU) < 0) and (GetKeyState(49) < 0) then
soalnya pas nyoba showmessage hasil GetKeyState-nya itu selalu minus. Jadinya dicek kondisinya apakah < 0.....
more 17 years ago
MrLee
Bisa gunakan ini nih
SHORCUT KEY Tamabahkan
uses menus nya
pada TForm onKeyDown atau onKeyup
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
// ShowMessage(UpperCase(ShortCutToText(ShortCut(Key, Shift))));
if UpperCase(ShortCutToText(ShortCut(Key, Shift))) = 'SHIFT+CTRL+ALT+F12' then
begin
Proses disini;
end;
end;
atau
procedure TForm1.FormkeyDown(Sender: TObject; var key: word;
Shift : TShiftState);
begin
//Aktifkan KeyPreview menjadi TRUE
//Shorcut ctrl-A (ssShift, ssAlt, ssCtrl)
if (ssCtrl in Shift) and (chr(Key) in ['A', 'a']) then
Showmessage('Ctrl-A di tekan');
//Mematikan shortcut Alt-F4
if (ssAlt in Shift) and (Key= VK_F4)then
key := 0;
end;
more ...
- Pages:
- 1
reply |
Report Obsolete
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 4 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 12 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 12 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 12 years ago
Random Topic
- Pemula : Tentang Delphi Component
by onClinic in Hal umum tentang Pascal Indonesia more 16 years ago - Meletakkan Program Dalam IC
by isoke in Hal umum tentang Pascal Indonesia more 16 years ago - View Data di DbGrid
by fat_279 in Tip n Trik Pemrograman more 15 years ago - mendapatkan kode rantai dari citra biner
by picastana in Enginering more 15 years ago - Program memecah kata menjadi suku kata
by alfian in Tip n Trik Pemrograman more 18 years ago - Report menyamping
by mambamaestro in Hal umum tentang Pascal Indonesia more 15 years ago - Koneksi di file dll
by EkoIndri in Lain-lain more 16 years ago - load dokumen dari database
by buyungff in Tip n Trik Pemrograman more 15 years ago - data
by zsaZsa in Network, Files, I/O & System more 17 years ago - Task Manager
by saysansay in Tip n Trik Pemrograman more 18 years ago