> This is a great idea John!.  I originally was using C++ Builder to design
> my Win32::GUI forms so I could get the pixel coordinates.  I'm anxious to
> try letting your script create the perl GUI code for me.  A Win32::GUI
> forms designer is in progress (3 cheers to those doing it),

  thanks.  ;)

> but this seems to me to be better solution (at least in the short term)
> since we are not re-inventing the wheel writing a new IDE. 

  Yes, it is quite a bit of work creating a GUI designer, but it's fun.  :)

  As I don't have the Borland's C++ or Delphi products I guess it's a
  Win32::GUI builder for me.

  I can at least get ideas from the GUI code converted with dfm2gui.

> In the long run it will be nice to have a Win32::GUI designer that evolves
> with the Win32::GUI Extension.

  yes.
   
> Eric
>   -----Original Message-----
>   From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of John McNamara at
> Exponent Engineering
>   Sent: Sunday, December 12, 1999 5:08 PM
>   To: [EMAIL PROTECTED]
>   Subject: [perl-win32-gui] Converting Delphi/C++Builder Forms to Win32::GUI
> templates
> 
> 
>   I have attached a perl script called "dfm2gui" that converts
>   Delphi/C++Builder Forms to Win32::GUI templates. This allows you to
>   use Delphi or C++Builder to design Win32::GUI windows and packages.
> 
>   If you do not already use Delphi this script will be of little
>   interest to you.
> 
>   This is a work in progress. Not all Delphi components are supported.
>   Not all GUI packages are supported. As it stands it will produce a
>   working Win32::GUI script to which you can add your own code.
> 
>   In version 0.023 the following are implemented:
>       1. 19 of the Win32::GUI packages. See the %TControl hash.
>       2. Main menus.
>       3. Pop-up menus.
>       4. Inline bitmaps and icons.
>       5. Placeholder events.
> 
>   The following items need work/implementation:
>       1. Indication of which objects weren't parsed to packages.
>       2. String items in ComboBoxes, Memos etc.
>       3. Fonts.
>       4. Some way of getting the images out of an Imagelist.
>       5. Toolbars.
>       6. Lots of other things.
> 
>   The script will only work with text versions of a DFM. It calls an
>   external program to convert binary files as needed.
> 
>   I have included some sample Delphi Forms and their Win32::GUI
>   equivalents. The script is used as follows:
> 
>       Usage  : dfm2gui input.dfm [output.pl]
>       Example: dfm2gui Myform.dfm Mygui.pl
> 
>       Options: [output]   If no output file is specified then the
>                           filename of the input file is used and the
>                           extension is changed.
> 
>   Ciao,
> 
>   John McNamara [EMAIL PROTECTED]
>   ----------------------------------
> 
>   Additional information:
> 
>   If you haven't already used Delphi you probably don't want to go to
>   the trouble of learning it just to use it as a form builder for
>   Win32::GUI.
> 
>   Delphi is Borland's Integrated Development Environment for the Object
>   Pascal language. As a concept it is quite similar to Visual Basic.
>   Both Delphi and C++Builder store information about Forms in a common
>   DFM format. Therefore, any of the following information about Delphi
>   is also applicable to C++Builder.
> 
>   A Delphi "Form" is equivalent to a Win32::GUI Window with its
>   associated packages. The Form information is stored in a DFM file. In
>   Delphi 1 to Delphi 4 the DFM file is in a binary format. In Delphi 5
>   the Form can be stored as either binary or text.
> 
>   Note: The Dfm2GUI script does not work with the binary version of DFM
>         files. It attempts to use the external dfm2txt utility to
>         convert binary forms to text prior to parsing.
> 
>   A sample Delphi Form with a single button is stored as follows (some
>   information has been omitted for clarity):
> 
>           object MainForm: TMainForm
>             Left = 192
>             Top = 133
>             Width = 256
>             Height = 158
>             Caption = 'Sample Delphi Form'
>             object Button: TButton
>               Left = 67
>               Top = 53
>               Width = 113
>               Height = 25
>               Caption = 'Hello from Delphi!'
>             end
>           end
> 
>   This is parsed to the following Win32::GUI style data:
> 
>           $MainForm = new Win32::GUI::Window(
>               -name          => 'MainForm',
>               -left          => 192,
>               -top           => 133,
>               -width         => 256,
>               -height        => 158,
>               -text          => 'Sample Delphi Form',
>               -visible       => 1,
>           );
> 
>           $MainForm->AddButton(
>               -name          => 'Button',
>               -left          => 67,
>               -top           => 53,
>               -width         => 113,
>               -height        => 25,
>               -text          => 'Hello from Delphi!',
>           );
> 
> 
>   For more information on Delphi try:
> 
>       http://www.borland.com/delphi/
> 
> 
> 
>   Dfm2GUI.zip contains the following:
>       dfm2gui.pl   - The parsing script
>       dfm2txt.exe  - A dos utility to convert binary forms to text
>       wdfm2txt.exe - A windows utility to convert binary forms to text
>       dfm2gui.txt  - This text.
>       Demo.dfm     - and  Win32::GUI equivalent
>       Calc.dfm     - and  Win32::GUI equivalent
>       Hello.dfm    - and  Win32::GUI equivalent
>       Recurse.dfm  - and  Win32::GUI equivalent
>       Wdfm2txt.dfm - and  Win32::GUI equivalent
>       Binary.dfm   - Binary format of Wdfm2txt.dfm
> 
> 
> 
> 
> 
> 
> ------=_NextPart_000_0006_01BF4556.E7324A80
> Content-Type: text/html;
>       charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
> charset=3Diso-8859-1">
> 
> 
> <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR></HEAD>
> <BODY>
> <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
> class=3D187113516-13121999>This=20
> is a great idea John!.&nbsp; I originally was using C++ Builder to =
> design my=20
> Win32::GUI forms so I could get the pixel coordinates.&nbsp; I'm anxious =
> to try=20
> letting your script create the perl GUI code for me.&nbsp; =
> A&nbsp;Win32::GUI=20
> forms designer is in progress (3 cheers to those doing it), but this =
> seems to me=20
> to be&nbsp;better solution (at least in the short term) since we are not =
> 
> re-inventing the wheel writing a new IDE. In the long run it will be =
> nice to=20
> have a Win32::GUI designer that evolves with the Win32::GUI=20
> Extension.&nbsp;&nbsp;&nbsp;</SPAN></FONT></DIV>
> <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
> class=3D187113516-13121999></SPAN></FONT>&nbsp;</DIV>
> <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
> class=3D187113516-13121999>Eric&nbsp;&nbsp;&nbsp; </SPAN></FONT></DIV>
> <BLOCKQUOTE>
>   <DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
> face=3DTahoma=20
>   size=3D2>-----Original Message-----<BR><B>From:</B>=20
>   [EMAIL PROTECTED]=20
>   [mailto:[EMAIL PROTECTED]]<B>On Behalf Of </B>John =
> McNamara at=20
>   Exponent Engineering<BR><B>Sent:</B> Sunday, December 12, 1999 5:08=20
>   PM<BR><B>To:</B> [EMAIL PROTECTED]<BR><B>Subject:</B>=20
>   [perl-win32-gui] Converting Delphi/C++Builder Forms to Win32::GUI=20
>   templates<BR><BR></DIV></FONT><TT>I have attached a perl script called =
> 
>   "dfm2gui" that converts<BR>Delphi/C++Builder Forms to Win32::GUI =
> templates.=20
>   This allows you to<BR>use Delphi or C++Builder to design Win32::GUI =
> windows=20
>   and packages.<BR><BR>If you do not already use Delphi this script will =
> be of=20
>   little<BR>interest to you.<BR><BR>This is a work in progress. Not all =
> Delphi=20
>   components are supported.<BR>Not all GUI packages are supported. As it =
> stands=20
>   it will produce a<BR>working Win32::GUI script to which you can add =
> your own=20
>   code.<BR><BR>In version 0.023 the following are=20
>   implemented:<BR>&nbsp;&nbsp;&nbsp; 1. 19 of the Win32::GUI packages. =
> See the=20
>   %TControl hash.<BR>&nbsp;&nbsp;&nbsp; 2. Main =
> menus.<BR>&nbsp;&nbsp;&nbsp; 3.=20
>   Pop-up menus.<BR>&nbsp;&nbsp;&nbsp; 4. Inline bitmaps and=20
>   icons.<BR>&nbsp;&nbsp;&nbsp; 5. Placeholder events.<BR><BR>The =
> following items=20
>   need work/implementation:<BR>&nbsp;&nbsp;&nbsp; 1. Indication of which =
> objects=20
>   weren't parsed to packages.<BR>&nbsp;&nbsp;&nbsp; 2. String items in=20
>   ComboBoxes, Memos etc.<BR>&nbsp;&nbsp;&nbsp; 3. =
> Fonts.<BR>&nbsp;&nbsp;&nbsp;=20
>   4. Some way of getting the images out of an =
> Imagelist.<BR>&nbsp;&nbsp;&nbsp;=20
>   5. Toolbars.<BR>&nbsp;&nbsp;&nbsp; 6. Lots of other things.<BR><BR>The =
> script=20
>   will only work with text versions of a DFM. It calls an<BR>external =
> program to=20
>   convert binary files as needed.<BR><BR>I have included some sample =
> Delphi=20
>   Forms and their Win32::GUI<BR>equivalents. The script is used as=20
>   follows:<BR><BR>&nbsp;&nbsp;&nbsp; Usage&nbsp; : dfm2gui input.dfm=20
>   [output.pl]<BR>&nbsp;&nbsp;&nbsp; Example: dfm2gui Myform.dfm=20
>   Mygui.pl<BR><BR>&nbsp;&nbsp;&nbsp; Options: [output]&nbsp;&nbsp; If no =
> output=20
>   file is specified then=20
>   =
> the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> 
>   filename of the input file is used and=20
>   =
> the<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> 
>   extension is changed.<BR><BR>Ciao,<BR><BR>John McNamara=20
>   =
> [EMAIL PROTECTED]<BR>----------------------------------<BR><BR>Additio=
> nal=20
>   information:<BR><BR>If you haven't already used Delphi you probably =
> don't want=20
>   to go to<BR>the trouble of learning it just to use it as a form =
> builder=20
>   for<BR>Win32::GUI.<BR><BR>Delphi is Borland's Integrated Development=20
>   Environment for the Object<BR>Pascal language. As a concept it is =
> quite=20
>   similar to Visual Basic.<BR>Both Delphi and C++Builder store =
> information about=20
>   Forms in a common<BR>DFM format. Therefore, any of the following =
> information=20
>   about Delphi<BR>is also applicable to C++Builder.<BR><BR>A Delphi =
> "Form" is=20
>   equivalent to a Win32::GUI Window with its<BR>associated packages. The =
> Form=20
>   information is stored in a DFM file. In<BR>Delphi 1 to Delphi 4 the =
> DFM file=20
>   is in a binary format. In Delphi 5<BR>the Form can be stored as either =
> binary=20
>   or text.<BR><BR>Note: The Dfm2GUI script does not work with the binary =
> version=20
>   of DFM<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; files. It attempts to use the =
> 
>   external dfm2txt utility to<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; convert =
> binary=20
>   forms to text prior to parsing.<BR><BR>A sample Delphi Form with a =
> single=20
>   button is stored as follows (some<BR>information has been omitted for=20
>   clarity):<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object =
> MainForm:=20
>   TMainForm<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> Left =3D=20
>   192<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Top =3D=20
>   133<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Width =
> =3D=20
>   256<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Height =
> =3D=20
>   158<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Caption =
> =3D=20
>   'Sample Delphi =
> Form'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
>   object Button:=20
>   =
> TButton<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
> bsp;=20
>   Left =3D=20
>   =
> 67<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> Top =3D=20
>   =
> 53<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> Width=20
>   =3D =
> 113<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
> =20
>   Height =3D=20
>   =
> 25<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> 
>   Caption =3D 'Hello from=20
>   Delphi!'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
>   end<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<BR><BR>This is =
> parsed to=20
>   the following Win32::GUI style=20
>   data:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $MainForm =3D =
> new=20
>   =
> Win32::GUI::Window(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
> bsp;&nbsp;&nbsp;=20
>   -name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   =
> 'MainForm',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
> p;&nbsp;=20
>   -left&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   =
> 192,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
> ;=20
>   -top&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> =3D&gt;=20
>   =
> 133,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
> ;=20
>   -width&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   =
> 256,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
> ;=20
>   -height&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   =
> 158,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
> ;=20
>   -text&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt; =
> 'Sample=20
>   Delphi=20
>   =
> Form',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
> sp;=20
>   -visible&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
>   );<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
>   =
> $MainForm-&gt;AddButton(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
> sp;&nbsp;&nbsp;&nbsp;=20
>   -name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   =
> 'Button',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
> &nbsp;=20
>   -left&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   =
> 67,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
> =20
>   -top&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> =3D&gt;=20
>   =
> 53,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
> =20
>   -width&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   =
> 113,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
> ;=20
>   -height&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt;=20
>   =
> 25,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
> =20
>   -text&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D&gt; =
> 'Hello from=20
>   Delphi!',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
> );<BR><BR><BR>For more=20
>   information on Delphi try:<BR><BR>&nbsp;&nbsp;&nbsp;=20
>   http://www.borland.com/delphi/<BR><BR><BR><BR>Dfm2GUI.zip contains the =
> 
>   following:<BR>&nbsp;&nbsp;&nbsp; dfm2gui.pl&nbsp;&nbsp; - The parsing=20
>   script<BR>&nbsp;&nbsp;&nbsp; dfm2txt.exe&nbsp; - A dos utility to =
> convert=20
>   binary forms to text<BR>&nbsp;&nbsp;&nbsp; wdfm2txt.exe - A windows =
> utility to=20
>   convert binary forms to text<BR>&nbsp;&nbsp;&nbsp; dfm2gui.txt&nbsp; - =
> This=20
>   text.<BR>&nbsp;&nbsp;&nbsp; Demo.dfm&nbsp;&nbsp;&nbsp;&nbsp; - =
> and&nbsp;=20
>   Win32::GUI equivalent<BR>&nbsp;&nbsp;&nbsp; =
> Calc.dfm&nbsp;&nbsp;&nbsp;&nbsp; -=20
>   and&nbsp; Win32::GUI equivalent<BR>&nbsp;&nbsp;&nbsp;=20
>   Hello.dfm&nbsp;&nbsp;&nbsp; - and&nbsp; Win32::GUI=20
>   equivalent<BR>&nbsp;&nbsp;&nbsp; Recurse.dfm&nbsp; - and&nbsp; =
> Win32::GUI=20
>   equivalent<BR>&nbsp;&nbsp;&nbsp; Wdfm2txt.dfm - and&nbsp; Win32::GUI=20
>   equivalent<BR>&nbsp;&nbsp;&nbsp; Binary.dfm&nbsp;&nbsp; - Binary =
> format of=20
>   Wdfm2txt.dfm<BR><BR><BR><BR><BR></BLOCKQUOTE></TT></BODY></HTML>
> 
> ------=_NextPart_000_0006_01BF4556.E7324A80--
> 
> 


Reply via email to