Skip to content

Commit 4974bab

Browse files
committed
fix: pre-select nothing in BOOL grid cell editor on PostgreSQL
Refs #1290
1 parent ca98ff7 commit 4974bab

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

source/dbconnection.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9040,8 +9040,8 @@ function TPGQuery.Col(Column: Integer; IgnoreErrors: Boolean=False): String;
90409040
SetString(AnsiStr, FConnection.Lib.PQgetvalue(FCurrentResults, FRecNoLocal, Column), FColumnLengths[Column]);
90419041
if Datatype(Column).Category in [dtcBinary, dtcSpatial] then
90429042
Result := String(AnsiStr)
9043-
else if Datatype(Column).Index = dbdtBool then
9044-
if AnsiStr='t' then Result := 'true' else Result := 'false'
9043+
else if (Datatype(Column).Index = dbdtBool) and (Length(AnsiStr) > 0) then
9044+
Result := IfThen(AnsiStr='t', 'true', 'false')
90459045
else
90469046
Result := Connection.DecodeAPIString(AnsiStr);
90479047
end;

source/main.pas

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10599,8 +10599,10 @@ procedure TMainForm.AnyGridGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
1059910599

1060010600
RowNumber := Sender.GetNodeData(Node);
1060110601
Results.RecNo := RowNumber^;
10602-
if Results.IsNull(ResultCol) and (not EditingAndFocused) then
10603-
CellText := TEXT_NULL
10602+
if Results.IsNull(ResultCol) then begin
10603+
// Grid editors come here through Tree.GetTextInfo(), provide empty string then
10604+
CellText := IfThen(EditingAndFocused, '', TEXT_NULL);
10605+
end
1060410606
else begin
1060510607
case Results.DataType(ResultCol).Category of
1060610608
dtcInteger, dtcReal: begin

0 commit comments

Comments
 (0)