Platforms to show: All Mac Windows Linux Cross-Platform

/Util/Locale/FormatMBS function desktop


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/Locale/FormatMBS function desktop

This example is the version from Fri, 13th Dec 2012.

Project "FormatMBS function desktop.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
End Control
EventHandler Sub Open() dim de as string = l("de_DE", "deu", "de_DE.UTF8") dim en as string = l("en_US", "english", "en_US.UTF8") dim fr as string = l("fr_FR", "fra", "fr_FR.UTF8") // test normal mode test "%f", 1.234 // default locale test "%f", 1.234, de // German test "%f", 1.234, en // US English test "%f", 1.234, fr // French test "%f", 1.0 // default locale test "%f", 1.0, de // German test "%f", 1.0, en // US English test "%f", 1.0, fr // French // one before comma, 2 after comma test "%1.2f", 1.234 // default locale test "%1.2f", 1.234, de // German test "%1.2f", 1.234, en // US English test "%1.2f", 1.234, fr // French // test exceptions test "%f%f", 1.23, fr // French test "%f", 1.23, "xxx" // invalid locale test "%s", 1.23, en // French End EventHandler
Sub Test(format as string, value as Double, locale as string = "") #pragma BreakOnExceptions false List.AddRow format try List.Cell(List.LastIndex,1) = formatMBS(format, value, locale) catch u as UnsupportedFormatException List.Cell(List.LastIndex,2) = u.message end try End Sub
Function l(Mac as string, Win as string, Lin as string) As string if TargetLinux then Return lin if TargetWin32 then Return win if TargetMacOS then Return mac End Function
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...