My Problem is : the checkbox will not get checked when clicking an empty checkbox.
My settings for the tNXDBCheckBox-column:
myDBCheckBoxColumn.ValueChecked = 'Wahr'; // myBoolfield.asString = 'Wahr', if myBoolField.Value = true
myDBCheckBoxColumn.ValueUnchecked = 'Falsch'; // myBoolfield.asString = 'Falsch', if myBoolField.Value = false
When clicking the checkbox, the procedure TNxDBCheckBoxColumn.ApplyField is called with Value = 'True'. This 'True' comes from the BooltoStr() - call in tNextDBGrid.DoColumnPlayChange.
CODE
procedure TNxDBCheckBoxColumn.ApplyField(Value: WideString);
var
B: Boolean;
begin
if ValueChecked = '' then
B := StrToBool(Value)
else begin
B := WideSameText(ValueChecked, Value); // !!!!! B is always false, because 'True' <> ValueChecked ('Wahr') !!!!!
end;
case B of
True: if FField.DataType = ftBoolean then
FField.AsBoolean := True
else FField.Text := ValueChecked;
False: if FField.DataType = ftBoolean then
FField.AsBoolean := False
else FField.Text := ValueUnchecked;
end;
end;
var
B: Boolean;
begin
if ValueChecked = '' then
B := StrToBool(Value)
else begin
B := WideSameText(ValueChecked, Value); // !!!!! B is always false, because 'True' <> ValueChecked ('Wahr') !!!!!
end;
case B of
True: if FField.DataType = ftBoolean then
FField.AsBoolean := True
else FField.Text := ValueChecked;
False: if FField.DataType = ftBoolean then
FField.AsBoolean := False
else FField.Text := ValueUnchecked;
end;
end;
Does tNxDBCheckboxColumn work for anyone in Germany / anyone not using english locale settings ?
Or am I missing something ?
In a previous version of TNxDBCheckBox, Applyfield looked like this :
CODE
procedure TNxDBCheckBoxColumn.ApplyField(Value: WideString);
begin
case StrToBool(Value) of
True: FField.Text := ValueChecked;
False: FField.Text := ValueUnchecked;
end;
end;
begin
case StrToBool(Value) of
True: FField.Text := ValueChecked;
False: FField.Text := ValueUnchecked;
end;
end;
This worked nice, but I guess Boki had a reason to change it. Here's my temporary workaround for tNXDBCheckBoxColumn.ApplyField:
CODE
//if ValueChecked = '' then
B := StrToBool(Value)
//else begin
// B := WideSameText(ValueChecked, Value);
//end;
case B of
True: if FField.DataType = ftBoolean then
FField.AsBoolean := True
else FField.Text := ValueChecked;
False: if FField.DataType = ftBoolean then
FField.AsBoolean := False
else FField.Text := ValueUnchecked;
end;
B := StrToBool(Value)
//else begin
// B := WideSameText(ValueChecked, Value);
//end;
case B of
True: if FField.DataType = ftBoolean then
FField.AsBoolean := True
else FField.Text := ValueChecked;
False: if FField.DataType = ftBoolean then
FField.AsBoolean := False
else FField.Text := ValueUnchecked;
end;
Boki, can you please review tNXDBCheckBoxColumn.ApplyField ?
Thank you very much !!!



Find content
Not Telling
