Using and mixing frameworks?

Just read http://www.xojo.com/blog/en/2015/04/using-using.php

It isn’t made clear, but am I right in assuming that using “Using” precludes mixing old and new framework?

[quote=180949:@Markus Winter]Just read http://www.xojo.com/blog/en/2015/04/using-using.php

It isn’t made clear, but am I right in assuming that using “Using” precludes mixing old and new framework?[/quote]

I have not tried yet …I don’t know what you would get with “Global.”, but on desktop I would guess it would be the old framework.

In any case a lot of the old functions and structures are available via “REALBasic.” (the REALBasic Module)

  • Karen

You can put “Using” in as general (i.e. a whole Class or Module) or as specific (inside a single [If/End If] block of code) as you like. So you can still decide exactly where you want to use the classic vs new framework even with Using.

I recently started a Desktop project in which I needed both old and new framework. Using is not terribly simple to use in such a case. I tried placing Using within an end if to scope it, but then I could not dim anything in there. Otherwise, Using is a one way ticket to the new framework. Once you place it, there is no return until the end of the method or event.

I ended up namespacing every single class.

I wish there was a Using Xojo.Old somewhere to go back to Kansas :wink:

[quote=180990:@Michel Bujardet]I recently started a Desktop project in which I needed both old and new framework. Using is not terribly simple to use in such a case. I tried placing Using within an end if to scope it, but then I could not dim anything in there. Otherwise, Using is a one way ticket to the new framework. Once you place it, there is no return until the end of the method or event.

I ended up namespacing every single class.

I wish there was a Using Xojo.Old somewhere to go back to Kansas ;)[/quote]

Use the Global keyword. For example, Global.Dictionary gets you the old one.

Oh, that is the piece of information missing from the LR.

Thank you Joe.

PS : Interestingly enough, searching for “Global” landed me in the Xojo Dev Center where all the namespaces are, but I could not see it there.

http://developer.xojo.com/using

The only legal target for a Using statement is a module (namespace). The first identifier will be resolved recursively, from inner to outer scope as usual. If you would rather skip the recursive search, you may use the Global variable.

And the Global page has a specific example that shows how to access both types of Dictionary in one method.

[code]Using Xojo.Core
Dim d As New Dictionary // Uses Xojo.Core.Dictionary

Dim d2 As New Global.Dictionary // Uses classic Dictionary class[/code]