- This topic has 4 replies, 2 voices, and was last updated 8 years ago by Avulso.
-
AuthorPosts
-
October 26, 2016 at 1:57 pm #37190AvulsoParticipant
Hello,
In comboedit I use the keydown action, with this action not set focus on a sdbgrid.
I try put the keydown action in Form too, but unsuccessfully.
This command:
sComboEdit1KeyDown
if ((key = vk_up) or (key = vk_down)) then
sDBGrid1.SetFocus;
FormKeyDown
if ((key = vk_up) or (key = vk_down)) then
if sComboEdit1.Focused then
sDBGrid1.SetFocus;
Sorry my bad english.
October 27, 2016 at 6:11 am #55714Gregory.PParticipantExemple :
Code:procedure TForm1.sComboEdit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key = vk_up) then
begin
ADOTable1.Prior;
sComboEdit1.Text := ADOTable1.FieldByName('Champ').Text;
end;if (key = vk_down) then
begin
ADOTable1.Next;
sComboEdit1.Text := ADOTable1.FieldByName('Champ').Text;
end;if Key = Vk_Return then
begin
ADOTable1.Edit;
ADOTable1.FieldByName('Champ').Text := sComboEdit1.Text;
ADOTable1.Post;
end;
end;October 27, 2016 at 12:34 pm #55715AvulsoParticipantMy keydown action:
Code:procedure TFormCadProdutos.sComboEdit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ((key = vk_up) or (key = vk_down)) then
sDBGrid3.SetFocus;
else if (key = VK_ESCAPE) then begin
sEdit19.Clear;
sComboEdit1.Clear;
end;
end;The VK_ESCAPE is ok, the problem is on set focus where arrow up or down pressed, but this action not set focus, i need to set manually.
Examples
sComboEdit focused;
sDBGrid focused;
October 27, 2016 at 1:53 pm #55718Gregory.PParticipantsEdit1 –> sDbGrid1 = SetFocus sDbGrid1 OK :a3:
Code:procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ((key = vk_up) or (key = vk_down)) then
begin
sDBGrid1.SetFocus;
end;
end;sComboEdit1 –> sDbGrid1 = No SetFocus sDbGrid1 :cs:
sEdit1 –> sComboEdit1 = SetFocus sComboEdit1 OK :a3:
sComboEdit1 –> sEdit1 = No SetFocus sEdit1 :cs:
Code:procedure TForm1.sComboEdit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ((key = vk_up) or (key = vk_down)) then
begin
sEdit1.SetFocus;
end;
end;Problème SetFocus TsComboEdit 😛
October 28, 2016 at 12:58 pm #55721AvulsoParticipantI solved this with begin code:
Code:if ((key = vk_up) or (key = vk_down)) then begin
key := 0;
sDBGrid3.SetFocus;
end;Thank's everyone. 🙄
-
AuthorPosts
- You must be logged in to reply to this topic.