Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   ObjectTextToBinary - Zeile zu lang (https://www.delphipraxis.net/172643-objecttexttobinary-zeile-zu-lang.html)

bwolf 15. Jan 2013 12:14

ObjectTextToBinary - Zeile zu lang
 
Hi,

wir haben bisher folgende Funktion verwendet um aus Text ein Object zu machen:

Code:
function StringToComponent(Value: AnsiString): TComponent;
var
  StrStream: TStringStream;
  BinStream: TMemoryStream;
begin
  StrStream := TStringStream.Create(Value);
  try
    BinStream := TMemoryStream.Create;
    try
      [COLOR="Red"]ObjectTextToBinary(StrStream, BinStream);[/COLOR]
      BinStream.Seek(0, soFromBeginning);
      Result := BinStream.ReadComponent(nil);
    finally
      BinStream.Free;
    end;
  finally
    StrStream.Free;
  end;
end;

Das hatte in Delphi 7 auch immer einwandfrei funktioniert.
Nach der Umstellung auf Delphi 2009 gibt es nun bei größeren Objekten folgenden Fehler (ausgelöst in der roten Zeile):

Zitat:

---------------------------
Benachrichtigung über Debugger-Exception
---------------------------
Im Projekt Programm.exe ist eine Exception der Klasse EParserError mit der Meldung 'Zeile zu lang in Zeile 1' aufgetreten.
---------------------------
Anhalten Fortsetzen Hilfe
---------------------------
Ich dachte zuerst es liegt an der Unicode-Umstellung und habe daher den Übergabeparameter als Ansistring deklariert, was aber nix gebracht hat.
Hat jemand eine Idee was los sein könnte?
Vielen dank!

Uwe Raabe 15. Jan 2013 13:21

AW: ObjectTextToBinary - Zeile zu lang
 
Delphi 2007 ist aber noch keine Unicode-Version - die kam erst mit Delphi 2009.

Könntest du mal den Text, der den Fehler auslöst, hier anhängen?

bwolf 15. Jan 2013 13:33

AW: ObjectTextToBinary - Zeile zu lang
 
Hm ja ich meinte Delphi 2009, hab es korrigiert.

Hier der Text der den Fehler verursacht:

Code:
---------------------------
Programm
---------------------------
  object dsAuftrag: TDataSource   Fields = <     item       Caption = 'Zeit_Vertrieb'       FieldName = 'Zeit_Vertrieb'       FieldType = 'double'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Zeit_Montage'       FieldName = 'Zeit_Montage'       FieldType = 'double'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Zeit_Lieferant'       FieldName = 'Zeit_Lieferant'       FieldType = 'double'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Zeit_Kunde'       FieldName = 'Zeit_Kunde'       FieldType = 'double'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant'       FieldName = 'Verursacher_Lieferant'       FieldType = 'logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Vertrieb'       FieldName = 'Verursacher_Vertrieb'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Montage'       FieldName = 'Verursacher_Montage'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Kunde'       FieldName = 'Verursacher_Kunde'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Wetter'       FieldName = 'Verursacher_Wetter'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Internorm1'       FieldName = 'Verursacher_Lieferant_Internorm1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Internorm2'       FieldName = 'Verursacher_Lieferant_Internorm2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Ideal1'       FieldName = 'Verursacher_Lieferant_Ideal1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Ideal2'       FieldName = 'Verursacher_Lieferant_Ideal2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Topic1'       FieldName = 'Verursacher_Lieferant_Topic1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Topic2'       FieldName = 'Verursacher_Lieferant_Topic2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Inotherm1'       FieldName = 'Verursacher_Lieferant_Inotherm1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Inotherm2'       FieldName = 'Verursacher_Lieferant_Inotherm2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Sonstige1'       FieldName = 'Verursacher_Lieferant_Sonstige1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Sonstige2'       FieldName = 'Verursacher_Lieferant_Sonstige2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Vertrieb1'       FieldName = 'Verursacher_Vertrieb1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Vertrieb2'       FieldName = 'Verursacher_Vertrieb2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Vertrieb3'       FieldName = 'Verursacher_Vertrieb3'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Montage1'       FieldName = 'Verursacher_Montage1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Montage2'       FieldName = 'Verursacher_Montage2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Montage3'       FieldName = 'Verursacher_Montage3'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Kosten_Material'       FieldName = 'Kosten_Material'       FieldType = 'Money'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Kosten_Montage'       FieldName = 'Kosten_Montage'       FieldType = 'Money'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Kosten_Info'       FieldName = 'Kosten_Info'       FieldType = 'Memo'       ControlType = ctText       ComboBoxItems = <>     end>   Left = 872    Top = 528  end
---------------------------
OK  
---------------------------

Uwe Raabe 15. Jan 2013 14:58

AW: ObjectTextToBinary - Zeile zu lang
 
Soweit ich das sehe, gibt es im Parser eine interne Beschränkung auf 4096 Zeichen pro Zeile.

bwolf 16. Jan 2013 11:00

AW: ObjectTextToBinary - Zeile zu lang
 
Ja du hast Recht - ein manuell eingefügter Zeilemumbruch hat das Problem behoben...
Danke für denm Hinweiß!


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:28 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz