[Gambas-user] old question: detect gambas version in code

Tobias Boege taboege at ...626...
Tue Jun 20 19:35:55 CEST 2017


On Tue, 20 Jun 2017, PICCORO McKAY Lenz wrote:
> i want to make a piece of software work in both gambas olders (gambas3 <<
> 3.5) and gambas newers (gambas >> 3.5.1)
> 
> by example, the smtp has some changes depending on the version, also the
> gridview too..
> 
> example:
> 
> SMTP was rewriten in 3.6 so Body are not present in 3.5
> http://gambaswiki.org/wiki/comp/gb.net.smtp/smtpclient/body?nh
> this makes some of my code not work in embebed devices that does not run
> modern versions of linux and some libs required by gambas 3.9
> 
> same behaviour with new rows.selection that are since 3.4
> http://gambaswiki.org/wiki/comp/gb.qt4/_gridview_rows/selection
> 
> so there's a way to detect gambas version and paste code respect that? (was
> answered some time ago, but i cannot find the mail)
> 

You can do a run-time check with System.FullVersion [1]. A compile-time
check is also possible by using the #If preprocessor syntax [2].

Regards,
Tobi

[1] http://gambaswiki.org/wiki/comp/gb/system/fullversion
[2] http://gambaswiki.org/wiki/lang/.if

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list