Crainiate Community

Support and discussion for users of Crainiate component software products
Welcome to Crainiate Community Sign in | Join | Help
in Search

Auto-arranging shapes in a palette

Last post 04-06-2006 3:53 AM by BenJonesNZ. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-06-2006 3:53 AM

    Auto-arranging shapes in a palette

    Hi, I have a screen which has a palette and a normal model. The user can drag shapes from the palette onto the model to build up a flow chart etc (pretty standard stuff).


    I used the example code in “Palette Example CS” to populate my palette and everything seemed to work ok. The palette was rendered, the items were arranged automatically, and if I resized the palette the items were automatically re-arranged.

    Now initially I was populating the palette only once when the form was first initialized, as I had a static list of shapes to add to the palette.


    I have now enhanced my application so that the list of items in the palette can change dynamically. There are two tabs in my application and changes in the first tab effect what shapes are available in the palette located in the second tab.


    Therefore I have some code in the tab control changed tab event which clears the existing palette and repopulates it each time the user switches from the first to the second tab. In order to clear the existing items from the palette I call *palette.Clear()*. I then add the new list of shapes.

    The first time I load the application and switch to the second tab (there are no shapes to remove yet) the palette is rendered correctly and the shapes are arranged as expected. However on every subsequent attempt to change tabs the existing shapes in the palette are removed and then repopulated and the palette is redrawn with all shapes at location 0,0 and no auto arranging is performed. Even if the palette is resized the shapes are not re-arranged.


    The issue is in the *palette.Clear()* somehow. This seems to be putting the palette in some unknown state which is preventing auto-arranging of any shapes. I have tried calling *palette.Shapes.Clear()* instead and the same thing happened.

    The only fix I have been able to come up with is to manually remove each shape from the palette by looping around the shapes collection and calling *palette.Shapes.Remove( shape.Key )*. When I then re-add the shapes the palette is auto-arranged as expected.

    This is not a show-stopper anymore, since I found the solution above, but can someone explain to me what is happening inside *palette.Shapes.Clear()*?

    NOTE: Version 3.8.2130.17732 of the Crainiate controls with .NET v1.1.

    • 219.89.51.18
  • 04-11-2006 6:28 PM In reply to

    Re: Auto-arranging shapes in a palette

    This issue has now been resolved, due to an internal error a renderlist was not being cleared and the locations were being applied to old object references.
    Please contact support for an updated version (3.8.2292 or later) if this is an issue which affects you.
    • 81.156.254.101
Page 1 of 1 (2 items)