View Issue Details

IDProjectCategoryView StatusLast Update
0029691LazarusLCLpublic2016-03-24 07:44
ReporterMichlAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOS7OS Version32bit
Product Version1.7 (SVN)Product Build51671 
Target Version1.6.2Fixed in Version1.7 (SVN) 
Summary0029691: TCustomGrid Column.SizePriority wouldn't be saved correct
DescriptionI see some issues of saving and loading of a grid. One simple fix is here to save the SizePriority of a Column correct (a simple typo bug).
Steps To Reproduceprocedure TForm1.FormCreate(Sender: TObject);
begin
  StringGrid1.SaveOptions := [soDesign, soAttributes, soContent, soPosition];
  if FileExists('stringgrid1.xml') then
    StringGrid1.LoadFromFile('stringgrid1.xml');
end;

procedure TForm1.FormClose(Sender: TObject;
  var CloseAction: TCloseAction);
begin
  StringGrid1.SaveToFile('stringgrid1.xml');
end;

Without the patch, all Columns get the default entries for the SizePriority.

After the patch, the Columns get the entries saved in the xml.


Simple test added.
Tagspatch
Fixed in Revision52029
LazTarget1.6.2
WidgetsetWin32/Win64
Attached Files
  • grids.pas.patch (607 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 51671)
    +++ lcl/grids.pas	(working copy)
    @@ -8687,7 +8687,7 @@
         if c.PickList.Count>0 then
           cfg.SetValue(cPath + '/picklist/value', c.PickList.CommaText);
         if c.IsSizePriorityStored then
    -      cfg.SetValue(cPath + '/sizepriority', c.SizePriority);
    +      cfg.SetValue(cPath + '/sizepriority/value', c.SizePriority);
         if not c.IsDefaultFont then
           CfgSetFontValue(cfg, cPath + '/font', c.Font);
         cfg.setValue(cPath + '/title/caption/value', c.Title.Caption);
    
    grids.pas.patch (607 bytes)
  • TestStringGrid.zip (2,068 bytes)

Activities

Michl

2016-02-21 14:55

developer  

grids.pas.patch (607 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 51671)
+++ lcl/grids.pas	(working copy)
@@ -8687,7 +8687,7 @@
     if c.PickList.Count>0 then
       cfg.SetValue(cPath + '/picklist/value', c.PickList.CommaText);
     if c.IsSizePriorityStored then
-      cfg.SetValue(cPath + '/sizepriority', c.SizePriority);
+      cfg.SetValue(cPath + '/sizepriority/value', c.SizePriority);
     if not c.IsDefaultFont then
       CfgSetFontValue(cfg, cPath + '/font', c.Font);
     cfg.setValue(cPath + '/title/caption/value', c.Title.Caption);
grids.pas.patch (607 bytes)

Michl

2016-02-21 14:56

developer  

TestStringGrid.zip (2,068 bytes)

Michl

2016-03-23 20:34

developer   ~0091316

* ping *

Hi Jesus,

I don't want to stress you but this bug is a simple typo bug and the patch can be merged. I think I couldn't done something wrong ;)

Have a look at the code:

Saving:
...
      cfg.setValue(cPath + '/valuechecked/value', c.ValueChecked);
      cfg.setValue(cPath + '/valueunchecked/value', c.ValueUnChecked);
      cfg.SetValue(cPath + '/picklist/value', c.PickList.CommaText);
      cfg.SetValue(cPath + '/sizepriority', c.SizePriority); <----- simple "/value" is forgotten
      cfg.setValue(cPath + '/title/caption/value', c.Title.Caption);
...
   
Loading:
...
    s := cfg.getValue(cPath + '/valuechecked/value', '');
    s := cfg.getValue(cPath + '/valueunchecked/value', '');
    s := cfg.GetValue(cPath + '/picklist/value', '');
    s := cfg.GetValue(cPath + '/sizepriority/value', ''); <----- here it is in the existing code
    c.Title.Caption := cfg.getValue(cPath + '/title/caption/value', 'title ' + IntToStr(i));
...

Jesus Reyes

2016-03-23 21:32

developer   ~0091321

Fixed, thank you.

Michl

2016-03-24 07:44

developer   ~0091327

Thanks! I've downloaded latest trunk (revision 52040) and it works fine.

Issue History

Date Modified Username Field Change
2016-02-21 14:55 Michl New Issue
2016-02-21 14:55 Michl File Added: grids.pas.patch
2016-02-21 14:56 Michl File Added: TestStringGrid.zip
2016-02-21 14:56 Michl Tag Attached: patch
2016-02-22 20:46 Jesus Reyes Assigned To => Jesus Reyes
2016-02-22 20:46 Jesus Reyes Status new => assigned
2016-03-23 20:34 Michl Note Added: 0091316
2016-03-23 21:32 Jesus Reyes Fixed in Revision => 52029
2016-03-23 21:32 Jesus Reyes LazTarget => 1.6.2
2016-03-23 21:32 Jesus Reyes Note Added: 0091321
2016-03-23 21:32 Jesus Reyes Status assigned => resolved
2016-03-23 21:32 Jesus Reyes Fixed in Version => 1.7 (SVN)
2016-03-23 21:32 Jesus Reyes Resolution open => fixed
2016-03-23 21:32 Jesus Reyes Target Version => 1.6.2
2016-03-24 07:44 Michl Note Added: 0091327
2016-03-24 07:44 Michl Status resolved => closed