On 5/2/10, David Galicia <[email protected]> wrote: > >> I found out an alternative solution that's safer and does away with my > >> pointer problems. I also found out why my server pushes made my app slow. > >> I'm such a dork for having to create a topic! > > > > It would be good to list the reasons in case anyone else encounters > > something similar. :) > > > In my map program, users can see others drag and drop objects around a > grid of container widgets. > > I don't use the dragged widget as a source anymore for a drop event; > instead I use the dragged widget's container as the source. The > container will at least have a longer lifetime than the dragged > widget. For my old way, I couldn't guarantee the dragged widget still > existed (someone may have dragged it to a trashcan widget or it could > have been deleted in a graphic update). > > Then, from the destination widget, I would emit a signal at the source > container widget's side that says: "the drop has been completed and > here are the destination coordinates." > > Draggable widgets inside the source container will interpret this > signal to see if the drop event applies to any of them. If it does > apply, the respective drag widget will alter its record in the > database with the location of its new parent container. > > Then the dragged widget passes its destination and origin coordinates > on the map to a service object that manages server pushes. Any > container widgets having the above coordinates will actualize their > contents again. As a result, everyone on the map program will see the > dragged widget be put in its new spot. > > (main point: ) > I like communicating via signals versus pointers. With pointers, I > have to hope the pointer I'm using to communicate is still valid. > Also, it keeps my container widget's implementation clean: I don't > want it to keep track of my draggable widgets. > > As for me making my server push process go faster, my widgets weren't > interpreting the update event properly: all widgets were refreshing > their contents versus certain ones. > > Sorry for being verbose.
Verbose is perfect, described it well. Thanks! ------------------------------------------------------------------------------ _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
