Print Page | Close Window

Bug In Begin Update!

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=3437
Printed Date: 31 May 2024 at 4:43am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Bug In Begin Update!
Posted By: Superpippo
Subject: Bug In Begin Update!
Date 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 mk:@MSITStore:C:\Programmi\Codejock%20Software\ActiveX\Xtreme%20Suite%20Pro%20ActiveX%20v9.60\help\SymbolReference.chm::/XtremePropertyGrid~PropertyGridUpdateContext_members.html - 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.

https://forum.codejock.com/uploads/Superpippo/2005-12-23_100202_CodejockBeginUpdateBug.zip - 2005-12-23_100202_CodejockBeginUpdateBug.zip

 

 



-------------
SuperPippo



Replies:
Posted By: Oleg
Date Posted: 26 December 2005 at 2:14am

 

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
             Set Category = wndPropertyGrid.AddCategory("Category " & iCategory)
            iID = iID + 1
             Category.Id = iID
 
          
             For iItem = 0 To 2
                 Set Item = Category.AddChildItem(PropertyItemBool, "Item " & iItem, True)
                  iID = iID + 1
                 Item.Id = iID
             Next
        Next

 



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


Posted By: Superpippo
Date Posted: 28 December 2005 at 3:56am

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

https://forum.codejock.com/uploads/Superpippo/2005-12-28_035237_codejockBeginUpdate.zip - 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


Posted By: Oleg
Date Posted: 30 December 2005 at 1:55am

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: https://forum.codejock.com/uploads/oleg/2005-12-30_015534_codejockBeginUpdate.zip - 2005-12-30_015534_codejockBeginUpdate.zip



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


Posted By: Superpippo
Date Posted: 30 December 2005 at 3:52am

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 mk:@MSITStore:C:\Programmi\Codejock%20Software\ActiveX\Xtreme%20Suite%20Pro%20ActiveX%20v9.60\help\SymbolReference.chm::/XtremePropertyGrid~PropertyGridUpdateContext_members.html - 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


Posted By: Oleg
Date Posted: 30 December 2005 at 1:16pm

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


Posted By: Superpippo
Date Posted: 03 January 2006 at 3:12am

Thank you Oleg.

Happy new year.



-------------
SuperPippo



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