GetChildShapes

Help
2009-03-13
2013-04-08
  • Hi ppl,

    I'm making an flow chart interpreter like Raptor (http://raptor.martincarlisle.com/). I'm using this library to support my development and all I can say is that it's AWESOME!

    But I've been messing around an strange behavior of wxSFGridShape, let me explain:

    I use GridShapes to simulate functions, where automatically I drop a wxSFEditTextShape with the function name, then the user starts to add different kind of shapes (rects,diamonds,etc) "interactively".

    Using the grid method GetChildShapes(null,sfsRECURSIVE) I figure out the LAST SHAPE, in order to connect it whit every new shape added.

    The problem is when the user change the function name (EditTextShape) it becomes the new LastShape, not the last added shape, breaking the order.

    I've been looking for a workaround with no success.  Can you guys help me?

    Thanks!

     
    • Hi,
      the order of managed grid's children is really changing every time you even click some managed shape so you shouldn't use the children list directly in your case. Instead of this you can use two new functions I've implemented in revision 198 which allow user to get pointer to managed shape specified by its lexicographic index or by row and column indexes. Declarations of these functions are as follows:

      wxSFShapeBase* wxSFGridShape::GetManagedShape(size_t index);
      wxSFShapeBase* wxSFGridShape::GetManagedShape(int row, int col);

      Note that all cell indexes are zero-based. For your needs you can simply use the first mentioned function in a way like this:

      pShape = pGrid->GetManagedShape( pGrid->GetChildrenList().GetCount() - 1 );

      I hope it will help you... :)

      Regards
      Michal

       
      • Hi Michal!

        I've downloaded the last trunk revision and tried to compile it but it crashes when I call GetManagedShape(). The error msg is:

        a.out: symbol lookup error: a.out: undefined symbol: _ZN13wxSFGridShape15GetManagedShapeEj

        What does it mean?

         
        • Sorry, I forgot to install the new binaries, hehe.

          Now it works great, thanks for the help!