Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - SOLVED: PropertyGrid Setmask problems
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SOLVED: PropertyGrid Setmask problems

 Post Reply Post Reply
Author
Message
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Topic: SOLVED: PropertyGrid Setmask problems
    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....
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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).
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.143 seconds.