Print Page | Close Window

Item value (Bug)

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=12116
Printed Date: 22 May 2025 at 1:17am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Item value (Bug)
Posted By: markmark
Subject: Item value (Bug)
Date Posted: 09 September 2008 at 12:50pm
Item changes all by its self:
 
In my example,
If you change the grid value and click away a message box will show.

But the value displayed in the property grid has now redisplayed the original value.

 

Is this a bug?

 

MArk
https://forum.codejock.com/uploads/20080909_124847_value.zip - uploads/20080909_124847_value.zip


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



Replies:
Posted By: Aaron
Date Posted: 10 September 2008 at 10:49am
Hi,
 
No it isn't Mark.
 
Not in this event, suppose you would check the entered value and it wouldn't be right, you are able to cancel the change. So the value must be still the same as before changing otherwise you would have to check the old value itself. After this event the value changed event will fire and the value is changed into the entered value. just as you see in your sample when displaying a MessageBox.
 
Hope this helps
 


-------------
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....


Posted By: markmark
Date Posted: 12 September 2008 at 3:30am

Hi

 

Internally the control does store both values, but to the user they have typed into the control a value and it may be that I am displaying a message box that says are you sure you want to set this value, the user look back at what they have typed only to see it back to the original value while the msgbox is displayed.

 

That can’t be correct.

 

Mark

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


Posted By: Aaron
Date Posted: 12 September 2008 at 4:24am
Hi Mark
 
Now I understand what you mean. If user types something and you display a messagebox, the original value is displayed again and you can't see what you entered. This is one for CJ to fix
 
If you really need this, you can use this workaround and in the meantime CJ can fix this
 
Private Sub pgPropertyGrid_AfterEdit(ByVal Item As XtremePropertyGrid.IPropertyGridItem, NewValue As String, Cancel As Boolean)
    Dim oldVal As String
    Dim newVal As String
   
    oldVal = Item.Value
    newVal = NewValue
   
    pgPropertyGrid.FindItem(Item.Caption).Value = NewValue
    Dim retval As VbMsgBoxResult
    retval = MsgBox("Are you sure you want to change " & oldVal & " into " & newVal & "?", vbOKCancel)
    If retval = vbCancel Then
        Cancel = True
        pgPropertyGrid.FindItem(Item.Caption).Value = oldVal
    End If
End Sub
 
 
 
 
 


-------------
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....


Posted By: markmark
Date Posted: 12 September 2008 at 8:25am
Thanks Aaron.
 
Thats a good workaround.
 
Mark


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


Posted By: Aaron
Date Posted: 12 September 2008 at 8:41am
Hi Mark,
 
It's nice to have a workaround if you are going to release your application yourself but and it's only temporary...
 
It will do nicely for now, but I expect CJ to fix this in next release
 
 
 
 


-------------
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....


Posted By: Oleg
Date Posted: 15 September 2008 at 5:58am
Hi,
AfterEdit don't know if you going to commit this change. Use ValueChanged even instead:
 
Private Sub pgPropertyGrid_ValueChanged(ByVal Item As XtremePropertyGrid.IPropertyGridItem)
MsgBox "A Message"
End Sub


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


Posted By: Aaron
Date Posted: 15 September 2008 at 7:03am
Hi Oleg,
 
In value change event the value is already set to entered value and checking here I have to know old value and as it behaves now, the value is changed into old value (user doesn't know what value he/she has entered) The workaround I showed could easely be done by you in after edit event. It works OK but don't change value into old value only if cancel = true.
 
Thanks
 
 


-------------
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....


Posted By: Oleg
Date Posted: 15 September 2008 at 10:31am
ok :),
btw what point in
pgPropertyGrid.FindItem(Item.Caption).Value = NewValue ?
Why not Item.Value = NewValue


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


Posted By: Aaron
Date Posted: 15 September 2008 at 10:55am
Hi,
 
Yes, you are correct Oleg,  it's unnecessary
 
For the ones who will use this until Oleg fixes this:
 
Private Sub pgPropertyGrid_AfterEdit(ByVal Item As XtremePropertyGrid.IPropertyGridItem, NewValue As String, Cancel As Boolean)
    Dim oldVal As String
   
    oldVal = Item.Value
    
    Item.Value = NewValue
 
    Dim retval As VbMsgBoxResult
    retval = MsgBox("Are you sure you want to change " & oldVal & " into " & newValue & "?", vbOKCancel)
    If retval = vbCancel Then
        Cancel = True
        Item.Value = oldVal
    End If
End Sub
 
 
Thanks a lot
 
 
 
 


-------------
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....


Posted By: markmark
Date Posted: 16 September 2008 at 4:22am
Thanks All
MArk


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



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