TsComboEdit

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #37190
    Avulso
    Participant

    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.

    #55714
    Gregory.P
    Participant

    Exemple :

    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;

    #55715
    Avulso
    Participant

    My 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;

    PA7F17c.jpg

    sDBGrid focused;

    IUh0qhA.jpg

    #55718
    Gregory.P
    Participant

    sEdit1 –> 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 😛

    #55721
    Avulso
    Participant

    I solved this with begin code:

    Code:
    if ((key = vk_up) or (key = vk_down)) then begin
    key := 0;
    sDBGrid3.SetFocus;
    end;

    Thank's everyone. 🙄

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.