Hi,
PRTreeView display sub items using the order of the children dictionary. A dictionary has no order, therefore items are shuffled. I would like to have sub items in the order in which I added them or, better, having a component to let me give my order. What is the best solution ? I thought of a 'priority' property for structures. This priority would then be used to sort the elements. _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
> PRTreeView display sub items using the order of the children
> dictionary. > A dictionary has no order, therefore items are shuffled. I would > like to > have sub items in the order in which I added them or, better, having a > component to let me give my order. > > What is the best solution ? Load the latest version of Pier, I fixed that yesterday :-) > I thought of a 'priority' property for structures. This priority > would then be used to sort the elements. The enhanced children visitor would allow to do exactly that. You just have to redefine the default sort-block in the default context used for new sessions. Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
Lukas Renggli wrote:
>> PRTreeView display sub items using the order of the children >> dictionary. >> A dictionary has no order, therefore items are shuffled. I would >> like to >> have sub items in the order in which I added them or, better, having a >> component to let me give my order. >> >> What is the best solution ? > > Load the latest version of Pier, I fixed that yesterday :-) What a synchronisation :-) >> I thought of a 'priority' property for structures. This priority >> would then be used to sort the elements. > > The enhanced children visitor would allow to do exactly that. You > just have to redefine the default sort-block in the default context > used for new sessions. Ok, but I need something to base the order on if I want to sort by creation time for exemple. In this case, I would need to modify ChildrenDecoration>>#add: to add an index, or Structure>>initialize to add a timestamp property. What do you think ? _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
>>> I thought of a 'priority' property for structures. This priority
>>> would then be used to sort the elements. >> >> The enhanced children visitor would allow to do exactly that. You >> just have to redefine the default sort-block in the default context >> used for new sessions. > > Ok, but I need something to base the order on if I want to sort by > creation time for exemple. In this case, I would need to modify > ChildrenDecoration>>#add: to add an index, or Structure>>initialize to > add a timestamp property. What do you think ? There are other possibilities: - Put the new value into a property and initialize it lazily. - Use the hook method that is called on the class-side of all concrete decorations when a structure is added to initialize a property. You don't need the decoration in this case, just the hook. Hope this helps, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
Lukas Renggli wrote:
>>>> I thought of a 'priority' property for structures. This priority >>>> would then be used to sort the elements. >>> The enhanced children visitor would allow to do exactly that. You >>> just have to redefine the default sort-block in the default context >>> used for new sessions. >> Ok, but I need something to base the order on if I want to sort by >> creation time for exemple. In this case, I would need to modify >> ChildrenDecoration>>#add: to add an index, or Structure>>initialize to >> add a timestamp property. What do you think ? > > There are other possibilities: > > - Put the new value into a property and initialize it lazily. > > - Use the hook method that is called on the class-side of all > concrete decorations when a structure is added to initialize a > property. You don't need the decoration in this case, just the hook. Thank you Lukas _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |