On Fri, 2006-06-02 at 16:22 +0200, SaTuRn 1 wrote: > Hello, > > I'm currently designing objects for Dia, that can be linked and I'm > wondering if its possible to catch events (like cut or delete) to > avoid technical problems ? > > I explain myself. I have a Box (first object) on which I can add > Connector (second object). This second object should not exist whitout > being on a Box. But when the user supress a Box its Conectors still > exist. > > I've seen in the sources that DiaObjects have parent/childrens > attributes. Will it solve the problem if I used these instead of my > own current lists ? > > Another related problem, that I have, is I can't forbid the user to > copy or cut the connector and paste it anywhere on the diagram (major > problem for me if he does not paste it on a Box...). The "copy" > problem : if I return NULL in the copy function of the Connector Dia > crashes. The "cut event" one : I haven't find how to catch the event > yet.
You probably want to use the parent/child system. But it won't prevent the user from unparenting (can't catch that) and cutting/copying it. You definitely shouldn't make copy return null, it's used in loading and/or creating new objects. Why shouldn't the connectors exist without a box? Do they use anything from the box? In general, Dia doesn't limit the placements of things much. -Lars _______________________________________________ Dia-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/dia-list FAQ at http://www.gnome.org/projects/dia/faq.html Main page at http://www.gnome.org/projects/dia
