Bug In Begin Update! |
Post Reply |
Author | |
Superpippo
Groupie Joined: 02 March 2005 Status: Offline Points: 67 |
Post Options
Thanks(0)
Posted: 23 December 2005 at 10:02am |
Hi Codejock guys! Here a christmas bug for you!!! Beginupdate\EndUpdate methods are bugfull. Propertygrid doesn't save at all status (item selected, sorting, item expanded etc. ) of the property grid!!! I have a propertygrid and i want update this propertygrid. According to the documentation, the BeginUpdate\EndUpdate let me save the status (item selected, sorting, item expanded etc. ) of the property grid inside a PropertyGridUpdateContext object, then i can update the propertygrid and at last i call endupdate to restore the status of propertygrid. Well, it doesn't work at all!!! Look at the sample in attachment, here i have a simple form with a propertygrid and a button. In the form_load i load the propertygrid with a category (mycategory) and an item (myitem). Pressing the command button i call code to add some category and item to property grid, this code is inside a beginupdate\endupdate. Ok now try the code, at first you can see the property filled with MyCategory and MyItem. But when you press the command button the propertygrid clear MyCategory and MyItem and and add all the others category. So propertygrid doesn't save at all status (item selected, sorting, item expanded etc. ) of the property grid!!! What's appened ??? Thank you in advance. 2005-12-23_100202_CodejockBeginUpdateBug.zip
|
|
SuperPippo
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Unfortunatelly it is not bug The secret of Beginupdate\EndUpdate methods that they store _ID_ of items was selected/expanded and set selection/expand state to item with same _ID_ after EndUpdate call: Here fix: Dim iCategory As Integer, iItem As Integer, iID As Integer For iCategory = 0 To 2
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Superpippo
Groupie Joined: 02 March 2005 Status: Offline Points: 67 |
Post Options
Thanks(0)
|
Dear Oleg, thank you for the answer. Have you tested your code ? I put it on my sample, but still doesn't work at all !!!! Here is my sample code with your workaround.... 2005-12-28_035237_codejockBeginUpdate.zip so you can see it doesn't work!!!! May be that it is really a bug, please let me know. Waiting for your answer, good year to all codejock staff. P.S. I am using 9.60.1 release of propertygrid.
|
|
SuperPippo
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Yes, I have tested it, but you didn't copy it. You forgot first line Dim iCategory As Integer, iItem As Integer, iID As Integer and delete "Private iID As Integer"
See result: 2005-12-30_015534_codejockBeginUpdate.zip |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Superpippo
Groupie Joined: 02 March 2005 Status: Offline Points: 67 |
Post Options
Thanks(0)
|
I don' t forget nothing. You can find the line as the first line in the code as follow: Private iID As Integer If you look better the code you can understand why i did so: the reason is that in the form load i start the population of propertygrid, so I save on iID the counter of items. When the user press the command button i add some categories and items on propertygrid, and i use iID to give correct .id property to everyone. But when i do so all the previous population of category and item are destroyed! Now I have understand that may be this is not a bug but a serious limit of beginupdate\endupdate implementation, since the PropertyGridUpdateContext object doesn't save an image of the population but just an image of properties of the items in the population. So if you want to update something in propertygrid you MUST rebuild all the grid!!! This way Beginupdate\Endupdate works fine but it's a really poor implementation!!! Everyway, thanks a lot Oleg, you are a really kind guy and the next time you came in Italy I will glad to eath a pizza with you !!!!
|
|
SuperPippo
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, Yes, it is the way how BeginUpdate works - it deletes all items on call.
But Everyway, Happy New year :) |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Superpippo
Groupie Joined: 02 March 2005 Status: Offline Points: 67 |
Post Options
Thanks(0)
|
Thank you Oleg. Happy new year. |
|
SuperPippo
|
|
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 |