Re: Programming Challenge: Reordering and Renumbering Control definitions
- Posted by "Juergen Luethje" <j.lue at gmx.de> Mar 26, 2005
- 513 views
Pete Lomax wrote: > Hi all, > > I am hoping someone will enjoy a little challenge, though bear in mind > this will be closed source. I am aware that I am being a little > cheeky asking for help... I disagree, I don't consider it cheeky for several reasons. > I think it is an interesting problem anyway. > > The problem is that Euphoria has no forward definitions, so all > parents must be defined before all child controls. Normally not a > problem, but if I want to allow a control, in a long list, to change > parent, I have to reorder, and renumber. Controls can be deeply > nested, but are held in a flat list. Something recursive is probably > required. I don't think that I've understood the situation completely ... But maybe a Topological Sort would be helpful: http://www.brpreiss.com/books/opus4/html/page557.html#SECTION0017330000000000000000 Recently I wrote a little Eu function that does Topological Sorting. If you want, I can (try to) translate the comments to English, and then post it here. <big snip> Regards, Juergen PS: Happy Easter to all (for whom it has a meaning)!