Displaying rows of data, PluggableMultiColumnListMorph

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Displaying rows of data, PluggableMultiColumnListMorph

hypolit
Hello,

i want to display the results of an ongoing calculation. I'm not terribly concerned about speed, as this is just for educational purposes.
So i figured that PluggableMultiColumnListMorph would be a good place to start.
My problem now is, that it only wants to take Arrays as its source list. Because i don't know how many rows of data need to be displayed, i just threw all of them in an OrderedCollection.
If i convert this OrderedCollection with "asArray" and feed it to the MultiColoumnMorph the contents are displayed just fine, but i can't select any entries or navigate using the arrow keys.
In fact, i can only select as much entries as there are columns in the Morph.

To illustrate, i did something roughly similiar to the following:

|column1 column2|
    result := OrderedCollection new.
    column1 := OrderedCollection new.
    column2 := OrderedCollection new.
    column1 add: 'x-component'; add: 'purz'; add: 'durst'; add: 'puh'.
    column2 add: 'y-component'; add: 'purz1'; add: 'durst1'; add: 'puh1'.
    result add: (column1 asArray); add: (column2 asArray).
    result := result asArray.

And it seems like PluggableMultiColumnListMorph doesn't treat "result" as a proper array.
Is there a possible workaround or do i absolutely have to work with simple arrays?
Or is there an even better way to display rows and columns of data?

Thanks in advance,
Peter Schneider

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Displaying rows of data, PluggableMultiColumnListMorph

Tapple Gao
On Fri, Oct 12, 2007 at 06:56:55PM +0200, Peter Schneider wrote:

>    Hello,
>
>    i want to display the results of an ongoing calculation. I'm not terribly
>    concerned about speed, as this is just for educational purposes.
>    So i figured that PluggableMultiColumnListMorph would be a good place to
>    start.
>    My problem now is, that it only wants to take Arrays as its source list.
>    Because i don't know how many rows of data need to be displayed, i just
>    threw all of them in an OrderedCollection.
>    If i convert this OrderedCollection with "asArray" and feed it to the
>    MultiColoumnMorph the contents are displayed just fine, but i can't select
>    any entries or navigate using the arrow keys.
>    In fact, i can only select as much entries as there are columns in the
>    Morph.
>
>    To illustrate, i did something roughly similiar to the following:
>
>    |column1 column2|
>        result := OrderedCollection new.
>        column1 := OrderedCollection new.
>        column2 := OrderedCollection new.
>        column1 add: 'x-component'; add: 'purz'; add: 'durst'; add: 'puh'.
>        column2 add: 'y-component'; add: 'purz1'; add: 'durst1'; add: 'puh1'.
>        result add: (column1 asArray); add: (column2 asArray).
>        result := result asArray.

I don't understand how this hooks up to
PluggableMultiColumnListMorph. Is this the getListSelector code?
Looking at the class comment, it says getListSelector should
return an OrderedCollection of Arrays, where each Array is a
row. You seem to be doing something in column-major order, so I
don't really see how this code is supposed to work

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Displaying rows of data, PluggableMultiColumnListMorph

hypolit
Yes, thats the getListSelector stuff.

Basically i just tried the PluggableMorphsDemo.pr, which you can download here: http://lists.squeakfoundation.org/pipermail/beginners/2006-May/000259.html (file  should end in .pr instead of .obj.)

The ListDemo2 doesn't work as expected. The getListSelector is feed the following Array:
self collection: #(
        "items in the first column"
        #('1a' '2a' '3a' '4a' '5a')
       
        "items in the second column"
        #('1b' '2b' '3b' '4b' '5b')
    ).

So i figured that order would be correct, at least in principle.
Now the there are two columns and four rows displayed with that data in PluggableMultiColumnListMorph.
But i can only select the first two rows.

Changing the the array like this:
self collection: #(
        #('1a' '2a' '3a' '4a' '5a')
        #('1b' '2b' '3b' '4b' '5b')
       #('1c' '2c' '3c' '4bc'  '5c')
    ).

Produces 3 columns and 4 rows. I can now select 3 rows.
I can't really see what i am doing wrong there.

I'm using the Squeak-dev 3.10 Image.

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners