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
[perl-win32-gui] Converting Delphi/C++Builder Forms to Win32::GUI templates
John McNamara at Exponent Engineering Sun, 12 Dec 1999 15:09:55 -0800 (PST)
- RE: [perl-win32-gui] Converting Delp... John McNamara at Exponent Engineering
- RE: [perl-win32-gui] Converting... Eric C. Hansen
- Re: [perl-win32-gui] Conver... David Hiltz