Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic Input Mask - Advice
Message
 
To
25/05/2001 19:38:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00511734
Message ID:
00511739
Views:
18
Hi Sandi,

If you have a "configuration" table for your app, you could store the desired default InputMask pattern for each installation of the app in that table. You could also store this in the Windows Registry, but this is easier.

Then, create a TextBox subclass just for Job #s (maybe called txtJobNumber) with a couple of properties:

- icClientMask
- ilAutoGenerate

and a method called AutoGenerate.

Populate the AutoGenerate() method with the desired VFP code to create and/or increment the desired value. Populate the Init() of the TextBox with (HERE'S THE KEY) the code to check the icClientMask property. If it's empty, read the configuration file, place the value in the icClientMask property, and set the TextBox's InputMask to the same value. However, if the icClientMask property is populated, set the InputMask to the specified pattern. Also include some code to check for the ilAutoGenerate flag and fire the AutoGenerate() method if it's true.

When you drop an instance of this TextBox on a form, you can then either:
1) use the mask in the config file, by doing nothing; or
2) fill in the mask in the instance to whatever you want.

Then, to have the control's value auto-generated, just flip the ilAutoGenerate flag. If you need special values for one of the instances, just write some code in the AutoGenerate() method for THAT instance to handle it how you desire.

HTH.

>I have an application that contains a field for Job #. One of my clients wants the mask to be XXXXXX-999 while another one wants XXXXXXXXXX the third wants 999999999 - auto generated. In the first case, when they add a new job for the same customer they want the same prefix and a new incremental number created so C12345-001, C12345-002, etc.
>
>Background: When setting up a customer they enter the code manually and in their current system it can be a max of 999999 (though they have never gotten larger than 99999), which they prefix with the first character of the customer's name. My customer number on my system is XXXXXXXXXX.
>
>In the second's case, they will enter their own code, which may be characters or numbers. In the third's case they want the system to generate the next number.
>
>Because of these differences, I thought I should store the input mask somewhere and use it dynamically. The question is what is the best way to do this, should I create a system setup field where the user enters the code if so how would I use this field - how can I code the property on the forms to use this edit mask???
>
>Any other suggestions would be welcome,
>TIA
>
>Sandi Cassidy
Evan Pauley, MCP
Positronic Technology Systems LLC
Knoxville, TN

If a vegetarian eats vegetables, what does a humanitarian eat?
Previous
Reply
Map
View

Click here to load this message in the networking platform