Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Util/Currency Tests
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/Currency Tests
This example is the version from Thu, 3rd Sep 2014.
Project "Currency Tests.rbp"
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 Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean if row < me.ListCount and not me.Selected(row) then dim v as Variant = List.CellTag(row, column) if v<>Nil then dim b as Boolean = v if b then // ok else g.ForeColor = &cFFCCCC g.FillRect 0, 0, g.Width, g.Height Return true end if end if end if End EventHandler
End Control
EventHandler Sub Open() test "4567890.1234" test "34567890.1234" test "234567890.1234" test "1234567890.1234" test "91234567890.1234" test "891234567890.1234" test "1091234567890.1234" test "1191234567890.1234" test "7891234567890.1234" test "67891234567890.1234" test "567891234567890.1234" test "+922337203685477.5807" test "-922337203685477.5807" test "123456789012345.1234" List.ColumnAlignment(0) = List.AlignRight List.ColumnAlignment(1) = List.AlignRight List.ColumnAlignment(2) = List.AlignRight List.ColumnAlignment(3) = List.AlignRight List.ColumnAlignment(4) = List.AlignRight End EventHandler
Sub test(s as string) #Pragma BreakOnExceptions false dim v as Variant = s dim c1 as Currency dim c2 as Currency = val(s) dim c3 as Currency = v.CurrencyValue try c1 = CurrencyValueMBS(s) List.AddRow s, str(C1), str(c2), str(c3), Format(c3, "0.0000") List.CellTag(List.LastIndex,2) = c1 = c2 List.CellTag(List.LastIndex,3) = c1 = c3 catch u as UnsupportedFormatException List.AddRow s, u.Message, str(c2), str(c3), Format(c1, "0.0000") end try End Sub
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

Feedback, Comments & Corrections

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

MBS FileMaker tutorial videos