<br><br><div class="gmail_quote">2010/11/16 Frank Church <span dir="ltr"><<a href="mailto:vfclists@gmail.com">vfclists@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><div class="gmail_quote"><div>
<br>Setting properties in code is fine, and some design IDE component can be used to generate the source code to initialize them at runtime.<br><br></div></div></blockquote></div><br>Thought about it recently, I think that having some IDE menu item "Paste as code" (for objects as text in clipboard) or external tool would be grea. And even if IDE doesn't have it, it's ok, I'll be glad living with a tool :). I see at least two ways to implement this<br>
<br>1. Converting the text to single call with incoming text accurately fitted to 'bla-bla-bla''#1310+ lines. The format of this text is exactly the same as text from lfm/dfm, just converted to be compatible pascal string constant <br>
PROS: <br>- easy to implement, one even doesn't have to know anything about the text format, just use the routines Lazarus uses itself.<br>- theoretically the same tool/wizard can also accept this fragment back in order to temporal designer edit since the conversion is not so complex<br>
CONS: <br>- rtti info have to be available at the time of creating so either explicitly the code should contain RegisterClass call or the developer should remember about this (correcting the statement after the first run). <br>
- component references can not be automatically resolved<br>- if some property was changed/removed, only run-time error for corrections would be possible<br><br>2. Other way is to convert it to correct pascal assignments/calls (the latter for TStringList, TCollection etc)<br>
PROS: <br>- compile-time errors for everything: absent uses entry, non-existing property etc, not-resolved component reference assigment. <br>- easy and safe in-place editing also with a little help of the compiler. <br>
CONS:<br>
- much harder to implement, one must know everything about the text lfm/dfm format for correct conversion. <br>-also much harder to implement backward conversion.<br><br>Did I forget something? Is it something also deserved to be mentioned?<br>
<br>Thanks,<br><br>Max Vlasov<br><br>