Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Issue storing font with TLMDStorXMLVault

I have installed the lastest (28 Dec '21) LMDTools in Delphi 11 and when using TLMDStorXMLVault to store a labels font settings I get an error at runtime...
Error reading TFont.Name:Invalid property value. Code for this is below.

  PPanel.Background := XMLStorage.ReadColor('ButtonBackground', 'Colour', clSilver);
  PPanel.PCaption[1].Text := XMLStorage.ReadString('LabelOne', 'Caption', 'TRCODE' );
  PPanel.PCaption[1].Top := XMLStorage.ReadInteger('LabelOne', 'Top', 1);
  PPanel.PCaption[1].Left := XMLStorage.ReadInteger('LabelOne', 'Left', 1);
  PPanel.PCaption[1].Font := XMLStorage.ReadFont('LabelOne', 'Font', TFont.Create);
  PPanel.PCaption[1].Align := XMLStorage.ReadInteger('LabelOne', 'Alignment', 1);
  PPanel.PCaption[1].AutoSize := XMLStorage.ReadBool('LabelOne', 'AutoSize', True);
  PPanel.PCaption[1].Visible := XMLStorage.ReadBool('LabelOne', 'Visible', True);

This worked OK with my earlier Delphi 10.4.2 and LMDtools ( not sure version but likely 2019 )

The XML file its trying to load is as below... full file attached

        <LabelOne>         
                <Caption Type="String">BRNAME</Caption>
                <Caption Type="string">TRCODE</Caption>
                <Top Type="Integer">1</Top>
                <Left Type="Integer">1</Left>
                <Font Type="Font">       
                        <Charset Type="Identifier">DEFAULT_CHARSET</Charset>
                        <Color Type="Identifier">clRed</Color>
                        <Height Type="Integer">-15</Height>
                        <Name Type="String">Tahoma</Name>
                        <Size Type="Integer">11</Size>
                        <Style Type="Set">fsBold</Style>
                </Font>
                <Alignment Type="Integer">2</Alignment>
                <AutoSize Type="Identifier">-1</AutoSize>
                <Visible Type="Identifier">-1</Visible>
        </LabelOne>

I changed the code to just store the file e.g.  XMLStorage.WriteFont('LabelTwo', 'Font', PPanel.PCaption[2].Font);
to see whether there was a difference and the only change was ..
  <Name Type="String">Tahoma</Name>        - this is the old file that doesn't load
  <Name Type="string">Tahoma</Name>         - this is how it saved the file with D11,LMD 2021.7
so I edited the original text file to lowercase 's' and it loads without error. 
However, ideally I would like the uppercase 'S' version to load OK so I dont have to change the files at my customer sites.

Phillip
 
zip
zip
PrintStationPanel.zip
705B

Comments

Sign In or Register to comment.