Print Page | Close Window

SOLVED: PropertyGrid Setmask problems

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=10088
Printed Date: 29 April 2024 at 1:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SOLVED: PropertyGrid Setmask problems
Posted By: Aaron
Subject: SOLVED: PropertyGrid Setmask problems
Date Posted: 04 April 2008 at 9:16am
Hi,
 
I want to prevent the user to type some characters. The * and ?
Is it possible with Setmask ? Prefer a (working) sample how to do this.
 
Thank you very much!!
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



Replies:
Posted By: Oleg
Date Posted: 04 April 2008 at 3:32pm
Hi,
Sorry no. Seems we need add regexp support for future :( Quite a lot of requests.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jpbro
Date Posted: 09 April 2008 at 9:03pm
Hi Oleg,

Regex would be cool, but it might be easier to implement a BeforeEditInsert event that allows us to cancel any changes before they happen. This would allow us to easily allow/disallow keypresses for any reason.

Something like


Private Sub BeforeEditInsert(NewText As String, Cancel As Boolean)
    If Instr(1, NewText, "*") Then
       ' Remove * characters from string to be inserted into item
       NewText = Replace$(NewText, "*", "")
    End If

    If IsNumeric(NewText) Then
          ' Do not allow numeric strings to be inserted into item
          Cancel = True
    End If
End Sub


In the above example, any * characters about to be inserted into the item edit box would be removed, then if the text to be inserted was numeric, then the insertion would be completely cancelled. This is a nonsense example, but it illustrates two features:

1) Ability to modify the insertion text instead of cancel it completely
2) Ability to cancel the insertion of text completely.

Maybe not as powerful as regex support, but it should be easier to implement as an interim solution (NOTE: by passing NewText as a string, it makes it possible to handle Pasted text as well as single key presses).


Posted By: Baldur
Date Posted: 22 April 2008 at 7:23am
In AfterEdit-Event you have the NewValue you can change or in ValueChanged-Event you can change the Item.Value-Property.


Posted By: Aaron
Date Posted: 22 April 2008 at 10:50am
Hi,
 
Yes, thanks. I did some workaround in the value changed event.
 
It's unbelievable that we have to do it like this. We have setmask and key events and both options are useless.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net