Jump to content

Editing a UniDBGrid cell


Volk65

Recommended Posts

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 guys!

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...