Jump to content

uniDBGrid - Enter key must move focus to cell below it (next row) while in editing mode


Luhan

Recommended Posts

Hi there, I am using Delphi.
As the title states, I want to move to the next cell below the one I am editing by just pressing enter. I have tried a few codes now but none works. Please any assistance would be gladly appreciated.

Link to comment
Share on other sites

On 1/23/2024 at 5:36 PM, Luhan said:

Can you help me with my question stated earlier tho please?

I use 2 event

1. After Post 

DiChuyen ='OK';

2. Keydown

procedure TfrmPhieuNXK.Grid_ChiTietKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin


  if (DiChuyen ='OK')
  and (Key <> VK_UP)
  and (Key <> VK_DOWN)
  and (Key <> VK_LEFT)
  and (Key <> VK_RIGHT) then
  begin

     FDQueryDMNVL_d.Edit;

    // Kiểm tra trạng thái của Caps Lock
    if GetKeyState(VK_CAPITAL) <> 0 then
    begin
      // Chuyển đổi ký tự sang chữ thường nếu Caps Lock được kích hoạt
      GiaTriDauTien := Char(Key);
    end
    else
    begin
      GiaTriDauTien := LowerCase(Char(Key));
    end;

    if ssShift in Shift then
    begin
      GiaTriDauTien := '';
    end;


     // Hiển thị giá trị đã lưu
     FDQueryDMNVL_d.FieldByName(Grid_ChiTiet.Columns[Grid_ChiTiet.CurrCol].FieldName).AsString := GiaTriDauTien;

     DiChuyen := '';

  end;

end;

Hope it can help you

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...