On 05/23/2011 10:01 PM, Kevin Fishburne wrote: > On 05/09/2011 09:59 PM, Benoît Minisini wrote: >>> Think of it like a spreadsheet instead of an array. I need each "row" >>> sorted by the value in a "column". The two column values are >>> ObjectNumber and ObjectY and the row represents the array index. >>> >>> There's got to be something like this in GAMBAS, but if not I can start >>> Google searching sort algorithms and make a procedure. >> >> - Put the objects you have to draw on the screen in a temporary array. >> - Define the (X,Y) final coordinates in two object variables. >> - Implement the "_sort" special method in the object class. >> >> That way, you just have to call "Sort" to sort only the objects you want the >> way you want. > > The documentation didn't do much to alleviate my confusion, so if anyone > understands this could you please post the simplest example possible? A > link to the documentation on the _sort special method might be enough (I > couldn't find it). As a refresher I'm basically trying to sort an array > by one of its elements, much like sorting a spreadsheet
Looks like Matti had the same question back in 2009: http://old.nabble.com/sort-multidimensional-arrays-td26051359.html#a26059190 The proposed solution sounds similar to the response given to me, though my feeble brain isn't able to convert it into code. Interesting that the post mentions a variant can be used as well as an object. Matti, if you're out there, do you have an example of how you sorted the example array in your post using these (or other) techniques? -- Kevin Fishburne Eight Virtues www: http://sales.eightvirtues.com e-mail: sa...@eightvirtues.com phone: (770) 853-6271 ------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user