Tecla de atalho em botões

Delphi

30/01/2004

Pessoal,

Como faço para colocar uma tecla de atalho em um botão.

Valeu.

Paulo


Oadventista

Oadventista

Curtidas 0

Respostas

Cabelo

Cabelo

30/01/2004

é simples, basta colocar & antes da letra que vc queira de atalho..

Ex : &Sair, neste caso quando vc apertar ALT + S, dispara o evento click do botão..

Sem mais

Cabelo


GOSTEI 0
Oadventista

Oadventista

30/01/2004

Cabello, é o seguinte tenho um botão em um form e quero não dessa forma mas por exemplo utilizar um F5, entendeu

Valeu


GOSTEI 0
Cabelo

Cabelo

30/01/2004

entendi, aqui vai

basta adaptar para o seu projeto..

procedure P_KeyDown(var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then Exit;
if Shift = [] then
begin
case Key of
VK_HOME : begin
if s_botoes[0].speedbotao.Enabled then
s_botoes[0].speedbotao.Click;
end;
VK_PRIOR : begin
if s_botoes[1].speedbotao.Enabled then
s_botoes[1].speedbotao.Click;
end;
VK_NEXT :begin
if s_botoes[2].speedbotao.Enabled then
s_botoes[2].speedbotao.Click;
end;
VK_END :begin
if s_botoes[3].speedbotao.Enabled then
s_botoes[3].speedbotao.Click;
end;
VK_F2 : begin
if s_botoes[4].speedbotao.Enabled then
s_botoes[4].speedbotao.Click;
end;
VK_F9 : begin
if s_botoes[7].speedbotao.Enabled then
s_botoes[7].speedbotao.Click;
end;
VK_ESCAPE: begin
if s_botoes[8].speedbotao.Enabled then
s_botoes[8].speedbotao.Click;
end;
VK_F3 : begin
if s_botoes[9].speedbotao.Enabled then
s_botoes[9].speedbotao.Click;
end;
VK_F11 : begin
if s_botoes[10].speedbotao.Enabled then
s_botoes[10].speedbotao.Click;
end;
VK_F12 : begin
if s_botoes[11].speedbotao.Enabled then
s_botoes[11].speedbotao.Click;
end;
end;
end
else if Shift = [ssctrl] then
begin
case key of
VK_INSERT:begin
if s_botoes[5].speedbotao.Enabled then
s_botoes[5].speedbotao.Click;
end;
VK_DELETE:begin
if s_botoes[6].speedbotao.Enabled then
s_botoes[6].speedbotao.Click;
end;
end;
end;
Key := VK_SHIFT;
end;

sem mais

Cabelo


GOSTEI 0
POSTAR