Article Preview
Buy Now
FEATURE
Easy Money Entry
Allowing the user maximum flexibility in entering monetary amounts
Issue: 20.3 (May/June 2022)
Author: Tom Baumgartner
Author Bio: Tom is retired and has enjoyed programming in Xojo as a hobby for over 20 years, especially during the Canadian winter when there is only curling and bridge to replace golf, fishing and playing tennis.
Article Description: No description available.
Article Length (in bytes): 17,615
Starting Page Number: 35
Article Number: 20305
Resource File(s):
project20305.zip Updated: 2022-05-05 14:11:44
Related Link(s): None
Excerpt of article text...
I have been using Quicken, a popular single-entry financial records application, for over 20 years. I have always thought that the user interface could be improved and I have wanted some retirement planning features. When I retired, I developed a Microsoft Excel spreadsheet for retirement planning that requires transferring information from Quicken at the beginning of each year. Recently, I embarked on a big app development project that will combine the financial records function and the long-term retirement planning function.
Every financial transaction requires entering a monetary value. Obviously that entry becomes a focus for a simple and easy user interface. This article presents my solution for user entry of the transaction amount. An example project is available for download. All the code in the original project for saving the transaction to a database has been removed, but the structure of the code remains so some of the example code will be more complex than necessary.
The user is allowed to enter any of the monetary number formats shown in Figure 1. Note that only the period is used as the decimal point in this example. The code could be modified to allow the comma as a decimal point.
Whether a new entry or an edit of an existing entry the user is presented a
DesktopTextField
(seeAPI 2.0 sidebar). When the entry is complete (user clicksSave
) it is transferred to aDesktopListBox
displaying all the entries for the particular account (for example, a credit card account).Rule one is: users can type into a text field in a huge variety of sequences. The code has to check the user's typing to prevent illegal monetary entries under all of the possible sequences. For example, the user could insert a digit or period into the middle of the already entered number or select a portion of the already entered number to replace with a single digit.
Begin by creating a sub-class of
DesktopTextField
, calledCurrencyTextField
. Add a propertypboolHavePeriod
asBoolean
. Add theKeyDown
event with the the code of Code Listing #1:
...End of Excerpt. Please purchase the magazine to read the full article.