Problem with scaling of DBGrid after read column settings from registry

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #70770
    Siegbert
    Participant

    Hello,

    I save/restore column-settings like this (short form only to demonstrate the type of saving to registry).

    Save in form-close:

      myGrid.Columns.SaveToStream(stream);
      with TRegistry.Create do
          if OpenKey(myAppKey, true) then WriteBinaryData('myGrid', stream.memory^, stream.Size);
    

    I restore the columns with code like this in form-create:

        if OpenKey(myAppKey, false) then ReadBinaryData('myGrid', stream.memory^,GetDataSize('myGrid'));
    

    With Delphi 10 and Delphi 11 and AlphaControls 16.17 the column-width grows every time this code is executed. With sm125 it grows 25% each time, sm150 grows 50%. Using sm100 all works fine.

    I work around it by decreaseing every column width by the factor of the scale-mode after loading it from registry.

    Am I doing something wrong here? Is form-close or form-create the wrong place to do the save/restore? Or is this a bug in AlphaControls?

    Thanks for any hint,
    Siegbert

    • This topic was modified 2 years, 9 months ago by Siegbert.
    • This topic was modified 2 years, 9 months ago by Siegbert.
    • This topic was modified 2 years, 9 months ago by Siegbert.
    • This topic was modified 2 years, 9 months ago by Siegbert.
    #70780
    Support
    Keymaster

    Hello, Siegbert
    As I understand, you are saving scaled values of column sizes.
    And when form is created, scaled values are loaded and scaled by the skin-engine later, again. Right?
    I think, your solution is correct in this case, sizes should be decreased after loading or before saving.
    I haven’t other ideas how to avoid it.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.