Hi,
I created a textbox event handler to only allow my textboxes to
accept numbers only with three permitted punctuation marks:
period (decimal), comma and minus (substract).
The script contains five text fields.
>>>The first of the three text fields should behave exactly as
spinners do. The conditions are as follows:
-TB_Spiner1 [minimum:0 ; maximum:1000 ; decimal Places:3] [FloatValue]
-TB_Spiner2 [minimum:1 ; maximum:100 ; decimal Places:0] [IntegerValue]
-TB_Spiner3 [minimum:-200 ; maximum:200 ; decimal Places:2] [FloatValue]
-*MouseWheel* Increment are 1 (when hold CTRLKey Increment are 10)
-*KeyArrows* (Up and Down) Increment are always 1 (one).
-*Escape* Key reset a value to the default
-*Return* Key executes and checks if the value is in acceptable limits.
-*Tab* Key select next active control in form.
I also allow to input *minus* only if selection start at the
beginning, and *Period* can be set only once. (for floats)
>>>Description and Conditions for the fourth text field:
*TB_valueInput1*: Fill the text filds with the numbers
[Float or Integer] while the sum are not > 300.
If the last entry exceeds the maximum (300) then it will be
deleted after you press *Return* key.
Allowed punctuation marks: (period, comma, minus).*Space* between the numbers are disallowed.
NOTE: The input must be *in one direction* i.e. all numbers must have either a positive or negative values e.g.([-10,-20,-30,] or [10,20,30,],so that the absolute value of the sum is greater than three hundred [abs(theSum) < 300]. Three hundred is the limit.
-*Escape* Key clear text field.
-*Return* Key executes and checks if the value is in acceptable
limits.
-*Tab* Key select next active control in mxsForm.
>>>Description and Conditions for the fifth text field:
*TB_valueInput2*: Fill the text filds with the positive and negative numbers [Float or Integer].Only limitation is:
the value of a number must be in range [min:-90 ; max:90].
If the value is greater than the allowed range then is replaced by zero when press *Return* key.
-*Escape* Key clear text field.
-*Return* Key executes and checks if the value is in acceptable limits.
-*Tab* Key select next active control in mxsForm.
I have several questions:
1. Is there an easier and better way to solve this? (show some example)
2. When i press (CTRL+V) or (RMB and Paste from contex menu) how to put Clipboard text through filter functions (from this script *fn numConvert* or *fn summerize*) before it is displayed in the text field.
I almost started to explore possibilities of .NET integration in maxscript.
Any ideas and suggestions are welcome! Thank you in advance and sorry for my english.
Branko
By barigazy · 2012-03-04