Skip to content

Commit 1895959

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

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
@@ -8911,8 +8911,8 @@ function TPGQuery.Col(Column: Integer; IgnoreErrors: Boolean=False): String;
89118911
SetString(AnsiStr, FConnection.Lib.PQgetvalue(FCurrentResults, FRecNoLocal, Column), FColumnLengths[Column]);
89128912
if Datatype(Column).Category in [dtcBinary, dtcSpatial] then
89138913
Result := String(AnsiStr)
8914-
else if Datatype(Column).Index = dbdtBool then
8915-
if AnsiStr='t' then Result := 'true' else Result := 'false'
8914+
else if (Datatype(Column).Index = dbdtBool) and (Length(AnsiStr) > 0) then
8915+
Result := IfThen(AnsiStr='t', 'true', 'false')
89168916
else
89178917
Result := Connection.DecodeAPIString(AnsiStr);
89188918
end;

source/main.pas

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

1037210372
RowNumber := Sender.GetNodeData(Node);
1037310373
Results.RecNo := RowNumber^;
10374-
if Results.IsNull(ResultCol) and (not EditingAndFocused) then
10375-
CellText := TEXT_NULL
10374+
if Results.IsNull(ResultCol) then begin
10375+
// Grid editors come here through Tree.GetTextInfo(), provide empty string then
10376+
CellText := IfThen(EditingAndFocused, '', TEXT_NULL);
10377+
end
1037610378
else begin
1037710379
case Results.DataType(ResultCol).Category of
1037810380
dtcInteger, dtcReal: begin

0 commit comments

Comments
 (0)