Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/String References Test
This example is the version from Thu, 7th Jun 2017.
Project "String References Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// test String references
dim a as string = "Hello"
dim b as string = a // no copy
dim c as string = left(a,5) // no copy
dim d as string = "Hello" // gets same constant string
dim pa as integer = GetStringMemoryAddressMBS(a)
dim pb as integer = GetStringMemoryAddressMBS(b)
dim pc as integer = GetStringMemoryAddressMBS(c)
dim pd as integer = GetStringMemoryAddressMBS(d)
#if RBVersion >= 2014.03 then
// test Text references
dim e as text = "Hello"
dim f as text = e // no copy
dim g as text = f.Left(5) // no copy
dim h as text = "Hello" // gets same constant text
dim pe as integer = GetTextMemoryAddressMBS(e)
dim pf as integer = GetTextMemoryAddressMBS(f)
dim pg as integer = GetTextMemoryAddressMBS(g)
dim ph as integer = GetTextMemoryAddressMBS(h)
// test Auto references
dim i as auto = "Hello"
dim j as auto = i // no copy
dim k as auto = "Hello" // same text, but new auto object
dim l as auto = k // no copy
dim pi as integer = GetAutoMemoryAddressMBS(i)
dim pj as integer = GetAutoMemoryAddressMBS(j)
dim pk as integer = GetAutoMemoryAddressMBS(k)
dim pl as integer = GetAutoMemoryAddressMBS(l)
#endif
dim m as Object = app
dim n as Object = m // no copy
dim o as Variant = 123 // new Variant object
dim p as Variant = o // no copy
dim pm as integer = GetObjectMemoryAddressMBS(m)
dim pn as integer = GetObjectMemoryAddressMBS(n)
dim po as integer = GetObjectMemoryAddressMBS(o)
dim pp as integer = GetObjectMemoryAddressMBS(p)
Break // see in debugger
End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS Util Plugin.