From d5d13bb85637585bbe70f6cba8c4be208b1800a7 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Wed, 12 May 2021 14:00:21 +0000 Subject: [PATCH] RxFPC:fix TRxDBCurrEdit ReadOnly - tnx bpranoto git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8029 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/trunk/rxdb/rxdbcurredit.pas | 36 +++++++++++++++-------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/components/rx/trunk/rxdb/rxdbcurredit.pas b/components/rx/trunk/rxdb/rxdbcurredit.pas index eb1d9582f..8cf37c3fe 100644 --- a/components/rx/trunk/rxdb/rxdbcurredit.pas +++ b/components/rx/trunk/rxdb/rxdbcurredit.pas @@ -192,20 +192,30 @@ end; procedure TRxDBCurrEdit.KeyDown(var Key: Word; Shift: TShiftState); begin inherited KeyDown(Key, Shift); - if Key=VK_ESCAPE then - begin - //cancel out of editing by reset on esc - FDataLink.Reset; - SelectAll; - Key := VK_UNKNOWN; + if Self.FDataLink.Editing then begin + + if Key=VK_ESCAPE then + begin + //cancel out of editing by reset on esc + + FDataLink.Reset; + SelectAll; + Key := VK_UNKNOWN; + + end + else + if (Key<>VK_UNKNOWN) then + begin + //make sure we call edit to ensure the datset is in edit, + //this is for where the datasource is in autoedit, so we aren't + //read only even though the dataset isn't realy in edit + FDataLink.Edit; + end; end - else - if (Key<>VK_UNKNOWN) then - begin - //make sure we call edit to ensure the datset is in edit, - //this is for where the datasource is in autoedit, so we aren't - //read only even though the dataset isn't realy in edit - FDataLink.Edit; + else begin + if Key <> VK_TAB then begin + Key := VK_UNKNOWN; + end; end; end;