View Issue Details

IDProjectCategoryView StatusLast Update
0005860JEDI VCL00 JVCL Componentspublic2012-09-10 14:15
ReporterRHoekAssigned Toobones 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.46 
Summary0005860: When using JvInspector with Variant properties the TJvInspector VariantItem does not return 'empty' variant
DescriptionWhen using variants, the JvInspector uses the TJvInspectorVariantItem class to edit the variant data.

First:
When typing an empty string (''), the empty string value is set in the variant.
I think is should be better for the control to set the value to 'Unassigned'.

Second:
When returning the variant value as a string, it's better to use the 'VarAsString' routine, instead of just assigning the variant tot the string.
Additional InformationORIGINAL CODE:

{ TJvInspectorVariantItem }

function TJvInspectorVariantItem.GetDisplayValue: string;
begin
  Result := Data.AsVariant;
end;

procedure TJvInspectorVariantItem.SetDisplayValue(const Value: string);
begin
  Data.AsVariant := Value;
end;


MODIFIED CODE:

{ TJvInspectorVariantItem }

function TJvInspectorVariantItem.GetDisplayValue: string;
begin
  // RH - 2012-04-19: Ensure correct string (Null, Empty)
  Result := VarToStr(Data.AsVariant);
end;

procedure TJvInspectorVariantItem.SetDisplayValue(const Value: string);
begin
  // RH - 2012-04-19: When displayvalue is empty string, then set Variant 'empty'
  if VarToStr(Value) = '' then
    Data.AsVariant := Unassigned
  else
    Data.AsVariant := Value;
end;
TagsNo tags attached.

Activities

obones

2012-06-11 17:28

administrator   ~0019853

Please provide the zipped sources of a sample application showing this.

2012-06-13 12:30

 

JVCL BUG - Variant property TJvInspector (empty string).zip (151,372 bytes)

RHoek

2012-06-13 12:31

reporter   ~0019945

I've uploaded the demo.

Please note: you need the modification of tracker isssue (5857) - which are included in the project - to make the variant property editing work at all.

obones

2012-06-13 14:19

administrator   ~0019952

Thanks, this is now in SVN

Issue History

Date Modified Username Field Change
2012-04-19 16:30 RHoek New Issue
2012-06-11 17:28 obones Note Added: 0019853
2012-06-11 17:28 obones Status new => feedback
2012-06-13 12:30 RHoek File Added: JVCL BUG - Variant property TJvInspector (empty string).zip
2012-06-13 12:31 RHoek Note Added: 0019945
2012-06-13 13:40 obones Status feedback => acknowledged
2012-06-13 14:19 obones Note Added: 0019952
2012-06-13 14:19 obones Status acknowledged => resolved
2012-06-13 14:19 obones Fixed in Version => Daily / SVN
2012-06-13 14:19 obones Resolution open => fixed
2012-06-13 14:19 obones Assigned To => obones
2012-09-10 14:15 obones Fixed in Version Daily / SVN => 3.46