Subject | Bug fix for boolean fields in TIB_Grid |
---|---|
Author | Jason Wharton |
Post date | 2010-01-07T06:58:26Z |
This one took a while to fix!
When clicking on boolean fields in D2009 and D2010 it would not repaint the focused cell which gave the appearance the value was not changing when in fact it was. I had to figure out exactly why it wasn't doing what it should and put in a workaround to make the base class go ahead and paint the focused cell.
function TIB_CustomGrid.CanEditShow: boolean;
begin
Result := inherited CanEditShow and
DataLink.Prepared and
( not RowSelect ) and
((AlwaysShowEditor or (goEditing in Options))) and
( Assigned( SelectedField ) and
( not ( SelectedField.IsArray or
( SelectedField.IsBoolean and IndicateBooleans ))) and
( not IsColLookup( SelectedField )));
// I added this chunk of code to overcome a grid painting issue.
{$ifdef IBO_VCL2009_OR_GREATER}
if ( not Result ) and
( Assigned( SelectedField )) and
( SelectedField.IsBoolean and IndicateBooleans ) then
EditorMode := false;
{$endif}
end;
Hope this helps.
As can be expected, this fix will be in the next release but I am putting it here in case others were not aware but would like to be and to fix it ASAP.
Thanks,
Jason Wharton
[Non-text portions of this message have been removed]
When clicking on boolean fields in D2009 and D2010 it would not repaint the focused cell which gave the appearance the value was not changing when in fact it was. I had to figure out exactly why it wasn't doing what it should and put in a workaround to make the base class go ahead and paint the focused cell.
function TIB_CustomGrid.CanEditShow: boolean;
begin
Result := inherited CanEditShow and
DataLink.Prepared and
( not RowSelect ) and
((AlwaysShowEditor or (goEditing in Options))) and
( Assigned( SelectedField ) and
( not ( SelectedField.IsArray or
( SelectedField.IsBoolean and IndicateBooleans ))) and
( not IsColLookup( SelectedField )));
// I added this chunk of code to overcome a grid painting issue.
{$ifdef IBO_VCL2009_OR_GREATER}
if ( not Result ) and
( Assigned( SelectedField )) and
( SelectedField.IsBoolean and IndicateBooleans ) then
EditorMode := false;
{$endif}
end;
Hope this helps.
As can be expected, this fix will be in the next release but I am putting it here in case others were not aware but would like to be and to fix it ASAP.
Thanks,
Jason Wharton
[Non-text portions of this message have been removed]