Example: /Util/MemoryStorage

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/Util/MemoryStorage


Required plugins for this example: MBS Main Plugin, MBS Util Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/MemoryStorage

This example is the version from Wed, 26th Jul 2016.

Project "MemoryStorage.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub Change() output.Backdrop = nil if me.ListIndex < 0 then // nothing else // load picture dim m as MemoryStorageMBS = List.RowTag(list.ListIndex) if m = nil then break else dim d as MemoryBlock = m.MemoryValue if d = nil then break else dim p as picture = Picture.FromData(d) output.Backdrop = p end if end if end if Exception o as OutOfMemoryException End EventHandler
End Control
Control Output Inherits Canvas
ControlInstance Output Inherits Canvas
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() static c as integer = 0 if c >= 1000 then Return // this demo should not go crazy dim s as MemoryBlock = MakeTestData if s = nil then break else dim m as new MemoryStorageMBS m.MemoryValue = s c = c + 1 List.AddRow "picture "+str(c) List.RowTag(List.LastIndex) = m end if Exception r as OutOfMemoryException // handle it? List.AddRow "out of memory for "+str(c) End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Function MakeTestData() As MemoryBlock static logo as Picture = LogoMBS(500) static counter as integer = 0 dim p as new Picture(2000, 2000, 32) dim x as integer = rnd * 1500 dim y as integer = rnd * 1500 dim g as Graphics = p.Graphics g.DrawPicture logo, x, y, logo.Width, logo.Height, 0, 0, logo.Width, logo.Height counter = counter + 1 g.TextSize = 50 g.DrawString str(counter), 100, 100 // we really waste here space by putting it as BMP in storage Return p.GetData(p.FormatBMP) End Function
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.


💬 Ask a question or report a problem