[Gambas-user] frm2form 0.01
Nelson Ferraz
nferraz at ...184...
Mon Jul 21 15:40:38 CEST 2003
Em Seg, 2003-07-21 às 00:57, Rob escreveu:
> Here is version 0.01 of frm2form.pl, which converts rudimentary VB forms into
> very, very rudimentary Gambas forms. It is a Perl program, and so you'll
> need Perl installed (but it should work on either Linux or Windows.)
Coool!!!
I've refactored your script, so it translate anything you put in the
following hash:
# Strings to translate (vb format => gb format)
my %trans = (
'VERSION (.+)' => '# Gambas Form File 1.0',
'VB\.(.+)\s+(.+)' => '$2 $1',
'Begin' => '{',
'End' => '}',
'BorderStyle' => 'Border',
'Caption' => 'Text',
'Command' => 'Button',
'\"(.+)\"' => '("$1")'
);
It also removes properties that we don't know how to handle (yet):
# Strings we don't know how to translate
my @nontrans = qw (
ClientHeight ClientLeft ClientTop ClientWidth
LinkTopic MaxButton MinButton ScaleHeight
ScaleMode ScaleWidth ShowInTaskbar TabIndex
);
Attached is the script, a sample vb form, and the resulting gambas form.
(Note: Gambas crashed when I tried to open it! :))
Regards,
Nelson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vb2gb.pl
Type: text/x-perl
Size: 1173 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20030721/79ce1385/attachment.pl>
-------------- next part --------------
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "System Login"
ClientHeight = 2940
ClientLeft = 2940
ClientTop = 3330
ClientWidth = 6060
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1737.049
ScaleMode = 0 'User
ScaleWidth = 5690.012
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Caption = "Login"
Height = 2895
Left = 0
TabIndex = 0
Top = 0
Width = 6015
Begin VB.CommandButton Command2
Caption = "Cancel"
Height = 375
Left = 2880
TabIndex = 6
Top = 1800
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "Enter"
Height = 375
Left = 600
TabIndex = 5
Top = 1800
Width = 1455
End
Begin VB.TextBox Text2
Height = 285
Left = 1920
TabIndex = 3
Top = 960
Width = 1935
End
Begin VB.TextBox Text1
Height = 285
Left = 1920
TabIndex = 1
Top = 480
Width = 2655
End
Begin VB.Label Label2
Caption = "Password:"
Height = 255
Left = 1080
TabIndex = 4
Top = 960
Width = 855
End
Begin VB.Label Label1
Caption = "User Name:"
Height = 255
Left = 960
TabIndex = 2
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public LoginSucceeded As Boolean
Private Sub cmdCancel_Click()
'set the global var to false
'to denote a failed login
LoginSucceeded = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'check for correct password
If txtPassword = "password" Then
'place code to here to pass the
'success to the calling sub
'setting a global var is the easiest
LoginSucceeded = True
Me.Hide
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
Private Sub lblLabels_Click(Index As Integer)
End Sub
-------------- next part --------------
# Gambas Form File 1.0
{ frmLogin Form
Border = 3 'Fixed Dialog
Text = ("System Login")
{ Frame1 Frame
Text = ("Login")
Height = 2895
Left = 0
Top = 0
Width = 6015
{ Button2 ButtonButton
Text = ("Cancel")
Height = 375
Left = 2880
Top = 1800
Width = 1455
}
{ Button1 ButtonButton
Text = ("Enter")
Height = 375
Left = 600
Top = 1800
Width = 1455
}
{ Text2 TextBox
Height = 285
Left = 1920
Top = 960
Width = 1935
}
{ Text1 TextBox
Height = 285
Left = 1920
Top = 480
Width = 2655
}
{ Label2 Label
Text = ("Password:")
Height = 255
Left = 1080
Top = 960
Width = 855
}
{ Label1 Label
Text = ("User Name:")
Height = 255
Left = 960
Top = 480
Width = 975
}
}
}
More information about the User
mailing list