setmask |
Post Reply |
Author | |
wakerunner
Groupie Joined: 29 September 2007 Status: Offline Points: 85 |
Post Options
Thanks(0)
Posted: 11 February 2008 at 1:05pm |
I'm having problems with the setmask. Set Item = category.AddChildItem(PropertyItemString, "Setting Name")
Item.SetMask ".0000", ".____" item.id=4
PG4.FindItem(4).Value = ".07"
The code above displays the property grid with the .07 in the value, then when you click on the value it changes it to ".____"
I am using this wrong? I am simply trying to limit the values that can be typed in. Is there a better way? There should be a "legal characters" property where you could simply set to ".0123456789" etc. for the characters it is legal to accept.
|
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
.0000 already limits it to only 0-9
|
|
wakerunner
Groupie Joined: 29 September 2007 Status: Offline Points: 85 |
Post Options
Thanks(0)
|
Yes I know that, but you didn't answer either question.
Question 1 Why does Setmask ".0000", ".____" change the vale ".07" to ".____" when you click on that value?
2nd Question, Is there another way of limiting input such as setting legal characters without using the setmask. If the setmask worked I guess it would be OK to use but as I said above either I am using it wrong or it does not work.
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi, When you use SetMask you have to fill the entire field. In your case you have to set the value to .0007 in this case the propertygriditem does accept the value. Normally I would accept this behaviour because we won't accept wrong values the user would enter, right?
But: I found something else,
Set Item = Category.AddChildItem(PropertyItemString, "Number", "Number: .00.7")
Item.SetMask "Currency: .0000", "Number: .____" When setting a value (sample above) to a PropertyGridItem, this value will be accepted .00.7 (notice the dot). This is strange ???
Your value .07 won't be accepted and this will . But we probably are doing something wrong Let's find out and listen to the master.
By the way, did you ever see a underscore in a IP address? I guess not
|
|
wakerunner
Groupie Joined: 29 September 2007 Status: Offline Points: 85 |
Post Options
Thanks(0)
|
It doesn't look like the master is going to reply to this thread.
It seems to me the setmask is very dysfunctional and does all kinds of weird things. It could be useful when you know the exact format that is needed such as a phone number.
There should be a "legalcharacters" property that you could set as follows:
propertygriditem.legalcharacters=".0123456789"
That would be useful for when you want to limit input but don't care about the exact format.
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi wakerunner
I think we are doing something wrong. I was strugling with the IP address item and I gave up. Check my post I did earlier
or
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |