[Gambas-devel] Some notes/quick hacks for porting your (big) Gambas2 project to Gambas3
Ron
ron at ...572...
Thu Jul 23 13:30:51 CEST 2009
Ok, so I don't like to do things twice, therefor I took some time to
find out how to port my project to development version quickly, not to
use it, but to be able to gather bugs/tips helping to make it better.
I'm sure I run into more things that needs work, but now it runs, and
seem to work fine, not bad at all.
Ok first...
Make a copy of your current Gambas2 project and try/work with that,
never load your original Gambas2 project into version 3 and try to
compile it!
If you try to load your Gambas2 project you get a warning, continue if
you want to follow the steps here.
It takes a bit of time to load the first time, because all your source
files (*.module, *.form and *.class) are moved to a new <project
dir>/.src directory, so they are hidden from now on, they are not gone.
Trying to compile your project results in an error about a wrong Form
file version, we fix that later.
If you save the project first the .project file with be converted for
you, some details below.
PROJECT FILE CHANGES:
<project dir>/.project
old syntax:
# Gambas Project File 2.0
# Compiled with Gambas 2.14
Title=DomotiGa
Startup=Main
Icon=images/logo.png
Version=0.1.168
Library=gb.qt
Library=gb.form
...
new syntax:
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0
Title=DomotiGa
Startup=Main
Icon=images/logo.png
Version=0.1.168
Component=gb.qt
Component=gb.form
...
Among other things, to find out later.
FORM SOURCE CHANGES:
Close project and goto your project source files directory
$ cd <project dir>/.src
Change form version:
old syntax:
# Gambas Form File 2.0
new syntax:
# Gambas Form File 3.0
howto port them quickly:
$ perl -pi -e "s/Gambas Form File 2.0/Gambas Form File 3.0/g;" *.form
Change window properties for normal forms:
old syntax:
Border = Window.Fixed
new syntax:
Resizable = False
Type = WindowType.Normal
howto port quickly:
$ perl -pi -e "s/Border = Window.Fixed/Resizable = False\n Type =
WindowType.Normal/g;" *.form
Change window properties for splash forms:
old syntax:
Border = Window.Fixed
new syntax:
Resizable = False
Type = WindowType.Splash
Note: Only run this on forms you know are of type splash. (the ones you
open with .Showmodal)
howto port quickly:
$ perl -pi -e "s/Border = Window.Fixed/Resizable = False\n Type =
WindowType.Splash/g;" yoursplash.form
PROJECT SOURCE CHANGES:
Some changes in syntax I came across till now.
.ForeColor property in textlabels has been renamed:
old syntax:
hText = New TextLabel(hPanel) As "Sensors"
With hText
.ForeColor = Color.Gray
new syntax:
.Foreground = Color.Gray
howto port quickly:
Do search and replace for it in your project.
Unknown symbol GridView in class DataBrowser has been renamed:
[GB.DB.FORM]
* NEW: DataBrowser.GridView property was replaced by DataBrowser.View.
* NEW: DataView.GridView property was replaced by DataView.View.
* NEW: DataView now uses a TableView instead of a GridView.
* NEW: DataView truncates cell contents to the first 1024 characters.
old syntax:
With DataBrowser1.GridView
new syntax:
With DataBrowser1.View
howto port quickly:
Do search for ".GridView" and replace with ".View" for it in your project.
What does this mean in console:
warning: Main.DisplaySensors.2996: ADD QUICK with Boolean
More suggestions are welcome, maybe useful to put this on the wiki
somewhere?
Regards,
Ron_2nd.
More information about the Devel
mailing list