How do I implement your seeting chart demo?

Dear Support:
It would be very helpful if you could give me some hints on the following questions.
What I am going to implement is quite similar to one of the oneline sample :
(in my case the tables can be created dynamically by the user)
However that one is in GoJS, while I need to do it in GoDiagram (C#).
More concretely, my questions are:
1. How to draw a group of shapes (one table and several seats) as one component, which can be created by drag and drop from pallette to the canvas? is this some kind of customized shape or subGraph or GoGroup?
2. When user drag and drop a people on the seat, How to assign/unassign the seat?
3. Any other tips on such usecase is also appreciated.
Many Thanks in advance

Let me be sure first… when you say GoDiagram, you mean WinForms? For Web apps, GoJS is the way to go, even if you want to do the server side in C#.

So… assuming WinForms, see Need to build a Theater seating diagram for the theater seater sample. It’s not in the evaluation kit.

And, when I get to work, I think I have a seating chart sample I did for someone a while back…

I emailed you the table / chair class extension to theater seater.

Hi Jake
Thanks for the reply
Yes, I mean WinForms, I am developing a stand alone desktop application, it has nothing to do with the web browser.
I am quoting the GoJS Seating Chart demo merely because that’s the behavior I’d like to achieve from the functionality perspective.

I am still not very sure how to assign/unassign people to a seat, in C#, could you say more about the case?

I tried to implement the “assign people to seat logic” in the following way but it does not go well:

Implement the OnObjectSelectionDropped method of the GoView, that I can

  1. get the people from GoView.Selection, and the table from GoObjectEventArgs.GoObject,
  2. set the position of people to the position of the corresponding seat (So it looks like the people is “sitting” on the seat)
  3. remove the people from GoView and add it to the table (which is a GoGroup), so that when user moving the table, the people goes remain seated.

But then I am stucked that when user want to drag this people to another table, I have no idea how to detach the people from the original table.

You would need a custom GoToolDragging that would grab the GoText and remove it from the Table Group.
At that point, the OnObjectSelectionDropped should work on the drop.

I don’t think I have a sample like that, let me go see if I have something close.

Actually… I think there’s a simpler way that gets you what you want. stealing from the GridApp sample, just teach the “DinnerTable” class how to handle a drop by doing this:

  // When dropping an item onto a DinnerTable, add it as a child object.
  // Don't add any DinnerTables!
  public override bool OnSelectionDropped(GoObjectEventArgs evt, GoView view)
      foreach (GoObject obj in view.Selection.CopyArray())
          if (obj is DinnerTable) view.Selection.Remove(obj);
      AddCollection(view.Selection, false);
      return true;

This handles a drag from a GoPalette or from another DinnerTable… so you don’t need the OnObjectSelectionDropped.