Jump to content

DBGRID Row Editor bug again ?


allenchow

Recommended Posts

I have a field with integer value either 0 or 1 (with checkboxfield enabled) .

When I click the checkbox directly, it has no problem. But if I edit other field with row editor opened, then I click the checkbox and confirm, error occur:

"Could not convert variant of type (Null) into type (OleStr)."

Please check and fix it ! Thanks !

Link to comment
Share on other sites

In the mean time, I've edit the unidbgrid.pas :

function TUniCustomDBGrid.XlatValue(Col: TUniBaseDBGridColumn; Fld: TField; Val: Variant): string;
...
  if Col.CheckBoxField.Enabled and (not Col.CheckBoxField.BooleanFieldOnly) then
  begin
    S := Col.CheckBoxField.FieldValues;
    sArr := ExtractBooleanValues(S);
    if Length(sArr) > 0 then
    begin
      // changed by Allen 29/09/2020
      if Val = Null then begin
          Result := sArr[1];

      end
      else begin
            B :=  StrToBool(Val);
            if B then
              Result := sArr[0]
            else
              Result := sArr[1];
      end;
    end;
  end

Link to comment
Share on other sites

4 hours ago, allenchow said:

But another problem :

When I edit the fields with roweditor, when I click the checkbox and edit the other field, only checkbox value saved and the value of the other field is not saved!

I've found that the problem is due to the AutoPost setting of the checkbox field  !! It will neglect other edited value unless I put the checkbox field to the last column !

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