Arsip: virtual key

 
user image
more 16 years ago

Yudho

Sori bro. Aku boleh nimbrung gak? Niy ada hubunganya banget dengan pertanyaan diatas. Aku coba untuk kkode TAB(vk_tab) koq nggak bisa ya? trus kalo kode ascii nya tab(vk_tab) berapa ya? kan kalo enter(vk_enter)=#13 trus kalo tab(vk_tab) berapa?
user image
more 16 years ago

Manz

vk_tab biasanya#8, vk_esc biasanya#27, hihihihihihi :D
user image
more 16 years ago

ansr

Aku juga mo nanya nih? kalo neken shift terus escape..... di event KeyDown aku pake script ini

if(shift = ssShift) and (key = VK_ESCAPE) then
    begin
      if button1.Visible = false then
        button1.Visible := true
      else
        button1.Visible := false;
    end; 
selalu error incompatible types padahal unit classes sudah ada.. mohon bantuannya..... trims :)
user image
more 16 years ago

Manz

@ansr: error incompatible types
itu berarti antara shift dengan key itu typedatanya tidak sama mas .... hihihihi :D
user image
more 16 years ago

kaka-delphi

Oh .. yach ... klo diriku untuk mengetahui tombol Shift, Ctrl, Alt dipencet, diriku suka pake fungsi berikut : ini untuk yang shift

function ShiftDown : Boolean;
var
   State : TKeyboardState;
begin
   GetKeyboardState(State) ;
   // ini untuk tombol Shift 
   Result := ((State[VK_SHIFT] and 128) <> 0) ;
end;
Misal untuk Shift+Esc berarti sbb :

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if ((ShiftDown) and (Key = VK_ESCAPE)) then
    ShowMessage('OKE');
end;
koding tersebut berlaku untuk shift kiri dan kanan. Untuk tombol Ctrl atau Alt, anda bisa mengubah index State-nya dengan virtual key codes nya, seperti :

function ShiftDown : Boolean;
var
   State : TKeyboardState;
begin
   GetKeyboardState(State) ;
   // ini untuk tombol Shift 
   Result := ((State[VK_SHIFT] and 128) <> 0) ;
   // ini untuk tombol Ctrl 
   // Result := ((State[VK_CONTROL] and 128) <> 0) ;
   // ini untuk tombol Alt
   // Result := ((State[VK_MENU] and 128) <> 0) ;
end;
SEMANGAT ;)
user image
more 16 years ago

ansr

teng kyu kaka_delphi..... informasinya sangat bermanfaat..... :D
user image
more 16 years ago

mas_kofa

@manz_delphi: vk_tab biasanya#8, vk_esc biasanya#27, hihihihihihi :D
tombol spasi nilainya juga#8ya?????
more ...
  • Pages:
  • 1
  • 2
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com