On 6 September 2010 02:31, Dimitri Smits wrote:
> you've got to love the IDE experts like GExperts in Delphi. There you define 
> your form as you want it to be through the editor and then "export to code". 
> In other words, a kind of "dfm"-writer that writes creation-initialization 
> code in objpas/fpc-code to the clipboard.
>


You can always port that to Lazarus, just like I have done for a few
other GExperts features. Then again, manually translating a dfm/lfm to
code is a rather simple task, so I don't really know if it's worth the
effort writing a tool to do that.

Long before GExperts I often used to select components in Delphi's
form designed. Copy to clipboard, and paste in code - especially data
aware components. Then translated them to Object Pascal code. The task
was very easy.

eg:
lfm code (copied to clipboard from form designer)
------------------------------
object Button1: TButton
  Left = 54
  Height = 25
  Top = 27
  Width = 75
  Caption = 'Hello'
  TabOrder = 0
end
object Edit1: TEdit
  Left = 56
  Height = 25
  Top = 64
  Width = 80
  TabOrder = 1
  Text = 'Edit1'
end
------------------------------

...now translated to Object Pascal code...

---------------------------------------
Button1 := TButton.Create(self);
with Button1 do
begin
  Left := 54;
  Height := 25;
  Top := 27;
  Width := 75;
  Caption := 'Hello';
  TabOrder := 0;
end;

Edit1 := TEdit.Create(self);
with Edit1 do
begin
  Left := 56;
  Height := 25;
  Top := 64;
  Width := 80;
  TabOrder := 1;
  Text := 'Edit1';
end;
----------------------------------------

See, near identical. A quick regex search and replace is all that is required.

-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to